Progress
Internationalization Guide
Processing By Characters
To keep your application code flexible so that it can handle multi-byte character data (the Chinese, Japanese, and Korean languages use double-byte code pages), do not process character data byte-by-byte. Also, do not assume that two bytes always equals two characters. By default, Progress functions process character data as whole characters, not as bytes. Make sure that you process all character data at the character level when appropriate. For example, a string-processing routine that examines each byte can mistake the second half of a double-byte character as a new character.
The following Progress code processes data by characters, not bytes, and as a result calculates the storage required incorrectly:
This procedure exports customer names to a file
NAMELIST.TXT
that is intended to fit on a 3.5-inch, 1.44 MB floppy diskette. The procedure quits if the list of names becomes larger than 1,440,000 bytes. However, since by default, the LENGTH function returns the character count, not the byte count of a string, this procedure does not work properly for multi-byte data. To correct the procedure, useLENGTH(name,"RAW")
instead ofLENGTH(name)
. Using the LENGTH statement with type set to RAW tells Progress to provide the byte count, not the character count.Another practice that might cause problems for international applications is using a specific numeric value for a character. Different locales use different character sets that have different numeric encoding systems. The letter “é” maps to the hexadecimal value E9 in the ISO 8859–1 code page, but maps to the hexadecimal value 82 in the IBM850 code page.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |