Progress
Language Reference


CODEPAGE-CONVERT Function

Interfaces
OS
SpeedScript
All
All
Yes

Converts a string value from one code page to another.

SYNTAX

CODEPAGE-CONVERT
  ( source-string
    [ , target-codepage [ , source-codepage ] ]
  ) 

source-string

A character expression to be converted.

target-codepage

A character-string expression that evaluates to the name of a code page. The name that you specify must be a valid code page name available in the DLC/convmap.cp file (a binary file that contains all of the tables that Progress uses for character management). If you supply a non-valid name, the CODEPAGE-CONVERT function returns the unknown value (?). Before returning a character value, the CODEPAGE-CONVERT function converts source-string from source-codepage to target-codepage. The returned character value is relative to target-codepage. If you do not specify target-codepage, no code page conversions occur.

source-codepage

A character-string expression that evaluates to the name of a code page. The name that you specify must be a valid codepage name available in the DLC/convmap.cp file. If you supply a non-valid name, the CODEPAGE-CONVERT function returns the unknown value (?). The source-codepage specifies the name of the code page to which source-string is relative. The default value of source-codepage is the value of CHARSET attribute of the SESSION handle.

EXAMPLE

This example assumes that the native code page of r-codpag.p is ibm850. It is written so that its embedded text strings are always converted to the internal code page of the Progress session (SESSION:CHARSET).

r-codpag.p
DEFINE VARIABLE cp850string AS CHARACTER INITIAL "text with umlaut (ä)".
DEFINE VARIABLE charsetstring AS CHARACTER.

charsetstring = CODEPAGE-CONVERT(cp850string, SESSION:CHARSET, "ibm850").

FOR EACH item:
    IF LOOKUP(charsetstring, item.cat-description) > 0 THEN DO:
        DISPLAY item.item-name.
    END.
END. 

NOTES

SEE ALSO

ASC Function, CHR Function, STRING Function


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095