Equinox Online Help - Language Reference - A to Z

Home

ChangeEncoding

Applies to
SyntaxChangeEncoding, source, target, how
Action[Statement] Changes the encoding of the string supplied between CP (Equinox native 8 bit format, Windows ANSI current code page), UTF-8, and UTF-16 (Unicode).
ScopeUsable anywhere.
Notes

This statement converts characters in the source string to a different encoding in the target string. The parameter how may take the following values:

  • 0 CP to UTF-8
  • 1 UTF-8 to CP
  • 2 CP to UTF-16
  • 3 UTF-16 to CP
  • 4 UTF-8 to UTF-16
  • 5 UTF-16 to UTF-8

Note that Equinox requires data to be in CP format in order to display it, and the method language operates on string data as a stream of CP bytes.

This statement provides a simplified interface to the Win32 functions MultiByteToWideChar and WideCharToMultiByte.

CategoryConversions
See Also  
Example

This example converts "Hello" to UTF-16, and prints a hexadecimal version of it

string w, h
ChangeEncoding "Hello", w, 2
HexEncode w, h
print h | 480065006c006c006f00