Converts a string value from one code page to another.
If source-string is a LONGCHAR variable, the source-codepage argument is not valid. In this case, the code page of the LONGCHAR variable is used as the source code page.
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 ABL session (SESSION:CHARSET).
r-codpag.p
DEFINE VARIABLE cp850string AS CHARACTER NO-UNDO INITIAL "text with umlaut (ä)". DEFINE VARIABLE charsetstring AS CHARACTER NO-UNDO. charsetstring = CODEPAGE-CONVERT(cp850string, SESSION:CHARSET, "ibm850"). FOR EACH Item NO-LOCK: IF LOOKUP(charsetstring, Item.CatDescription) > 0 THEN DISPLAY Item.ItemName. END. |