User Tools

Site Tools


toansi.htm
Navigation:  Language Reference > 13 - Built-in Functions >TOANSI (convert expression to ANSI) Previous pageReturn to chapter overviewNext page

TOANSI(string, codepage)

blk2blue.jpg

TOANSI Returns a string value converted to ANSI using the encoding of the Codepage parameter
string A string constant or string expression
codepage Codepage number used for encoding

The TOANSI function returns a string value converted to ANSI using the encoding of the Codepage parameter.  The value of the first parameter can be a Unicode string, an ANSI string, or even a numeric. The second parameter allows for conversions to/from ANSI strings encoded for languages other than the one in use by the OS.

As a side effect, the TOANSI function also allows to convert ANSI and Unicode strings to a character sequence encoded in UTF-8 by passing value 65001 as the second parameter.

Return Data Type:    String

example:

idname string(40)

UTFid   string(40)

CODE
idname = 'widget'
UTFid = TOANSI(idname, 65001)  ! encoded to UTF8

See Also:

TOUNICODE

toansi.htm.txt · Last modified: 2021/04/15 15:57 (external edit)