Consultor Eletrônico



Kbase P114958: What is the purpose of the -ulayout startup parameter?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/1/2008
Status: Verified

GOAL:

What is the purpose of the -ulayout startup parameter?

GOAL:

How do you use -ulayout to prevent truncation of multi byte UTF-8 characters?

FACT(s) (Environment):

OpenEdge 10.0B
All Supported Operating Systems

FIX:

Prior to 10.0B03, the creation of r-code text segments that included multi byte UTF-8 characters was problematic because the compiler could not cope with a multi byte characters that occupied fewer screen columns than bytes. The result of this is that the compiler did not reserve enough text segment space in the r-code for strings that included multi byte characters, and subsequently these strings where truncated when they were displayed.

To resolve this problem a new startup paramter called '-ulayout' was introduced with 10.0B03. The parameter is a client startup parameter that should be used by developers when compiling code and can be added to the client startup command line with "-ulayout <n>", where <n> is a value between 0 and 16. This value reflects the extra storage ratio of bytes per column needed to store strings with attributes.
Note: -ulayout only works on strings with string attributes!

For example, a string attribute of :R10 will be stored in ulayout × 10 bytes if ulayout is > 0. A value of 9 should handle almost all Unicode usage. A value of 0 reverts to the old behavior (and a value of 1 will be of almost no use).

An example of a string requiring 9 bytes per column is Thai text with a consonant, vowel and tone mark. In order for a 4GL programmer to determine a safe ulayout value for a string, compute the following value:

DEF VAR n as INT.
DEF VAR lencol AS INT.
lencol = LENGTH( string, "COLUMN" ) .
n = (LENGTH( string, "RAW" ) + lencol ? 1) / lencol .

If a string exceeds this ratio, it will be truncated and a warning message will be given:

"Unicode string has been truncated. To fit string, increase value of -ulayout."