Progress
Programming
Handbook
Performing Code-page Conversions
Computer systems store text data using character codes, typically 7 or 8–bit numeric codes that map to specific visual character representations. The series of character codes that make up the character set that a system uses is referred to as a code page.
Progress provides a character set management facility to automatically convert data between the code pages of different data sources and destinations (targets). In general, the supported data sources and targets for code page conversion include memory, streams, and databases. You can specify default code page conversions for a session using conversion tables and startup parameters to specify the code page for each data source and target. For more information on this character set facility, see the Progress Internationalization Guide .
The Progress 4GL also allows you to perform I/O that explicitly converts data from one code page to another in order to facilitate I/O between data sources and destinations intended for different computer systems or components. You can specify the name of the code page for a data source and target as parameters to several statements and functions.
To convert between source and target characters or strings in memory, you can specify code page parameters in these functions:
To convert data input and output, you can specify code page parameters in these statements:
To convert piped input and output, you can specify code page parameters in these statements:
These statements and functions take available code page name parameters as character expressions (for example, “ibm850”). The code page names you specify must be defined in your Progress conversion map file (
convmap.cp
, by default). Also, the source and target conversion tables must be defined in the conversion map file for each code page to support the specified conversions. For more information on building a conversion map file, see the Progress Internationalization Guide .For example, this procedure writes to two output streams using two different code pages:
For this example, assume that the internal code page is “iso8859–1”. If a customer name from the sports database is greater than or equal to a prompted name (xname), then the procedure writes the corresponding customer record to the file,
german.txt
, using the “german–7–bit” code page. Otherwise, it writes the corresponding customer record to the file,swedish.txt
, using the “swedish–7–bit” code page. These conversions are handled by the conversion tables provided with Progress.For more information on specifying code page parameters, see the reference entry for each statement or function that supports code page conversion in the Progress Language Reference .
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |