Function ConvToAnsiCP() Foundation

Converts a character string to an ANSI code page

Syntax
ConvToAnsiCP( <cOemFormatString> ) --> cAnsiFormatString
Parameters
<cOemFormatString>
<cOemFormatString> is a character string containing characters from an OEM character set.
Return

The function returns a string converted to ANSI.

Description

The function ConvToAnsiCP() converts character strings from OEM to ANSI. OEM and ANSI character sets differ especially in language specific special characters, like the German umlauts, for example.

Normally, a string conversion is not necessary since Xbase++ performs a conversion automatically. However, if data is exported from an Xbase++ application to be processed by other Windows programs, an explicit conversion to ANSI may be necessary. Also, if character strings are passed to Windows system API functions, they must be converted to ANSI.

This function works independent of the character set selected with the SET CHARSET command.

Examples
Converting character strings to ANSI

// All German umlauts are coded in this example as ANSI and OEM 
// strings. The OEM string is converted to ANSI. The output of the 
// program is redirected to a file which can be viewed in an ANSI 
// and OEM editor for better demonstration. 

PROCEDURE Main 
   LOCAL cAnsi, cOem 

   cAnsi := Chr(196)+Chr(228)+Chr(214)+Chr(246)+Chr(220)+Chr(252) 
   cOem  := Chr(142)+Chr(132)+Chr(153)+Chr(148)+Chr(154)+Chr(129) 

   SET ALTERNATE TO Oem_Ansi.txt 
   SET ALTERNATE ON 

   ? "ANSI      " , cAnsi 
   ? "OEM       " , cOem 
   ? 
   ? "CONV OEM  " , ConvToAnsiCP( cOem ) 

   SET ALTERNATE TO 
   SET ALTERNATE OFF 
RETURN 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.