CodePage Property  
 

Gets and sets the code page used when reading and writing text.

Syntax

object.CodePage [= value ]

Remarks

The CodePage property is an integer value which specifies how strings are encoded when data is sent or received. Any valid code page identifier may be specified. Some common values are:

Value Description
0 Text sent and received using a string should be converted using the ANSI code page for the current locale. This is the default encoding type.
1 Text sent and received using a string should be converted using the system default OEM code page. The OEM code page typically contains characters that are used by console applications and are based on character sets commonly used by MS-DOS. It is not recommended that you use this code page unless you know that the remote host is sending text which includes OEM characters.
1252 Text sent and received using a string should be converted using the Windows ANSI code page for western European languages. This code page is commonly used by legacy Windows applications for English and some other western languages. It should be noted that while this code page is similar to ISO 8859-1 character encoding, it is not identical.
28591 Text sent and received using a string should be converted using the ISO 8859-1 code page for western European languages. This code page is commonly referred to as Latin-1 and is similar to the Windows 1252 code page.
65000 Data that is sent and received using a string should be converted using UTF-7 encoding. If this code page is specified, data written to the socket will be encoded as UTF-7 encoded Unicode. All data received from the server will be converted from UTF-7. It is not recommended that you use this code page unless you know that the remote host is sending UTF-7 encoded text.
65001 Data that is sent and received using a string should be converted using UTF-8 encoding. If this code page is specified, data written to the socket will be encoded as UTF-8 encoded Unicode. All data received from the server will be converted from UTF-8 to UTF-16 Unicode. Because UTF-8 is backwards compatible with the ASCII character set, it is safe to use this encoding option when sending and receiving ASCII text.

A complete list of available code page identifiers External Link can be found in Microsoft's documentation for the Win32 API.

By default, strings are converted to an array of bytes using the code page for the current locale, mapping the 16-bit Unicode characters to bytes which are written to the virtual display. Similarly, when copying characters from the display into a string buffer, those characters are converted to Unicode before they are returned to your application.

For backwards compatibility, the control defaults to using the code page for the current locale. This property value directly corresponds to Windows code page identifiers, and will accept any valid code page in addition to the values listed above. Setting this property to an invalid code page will result in an error.

Data Type

Integer (Int32)

See Also

SelText Property, Text Property, Write Method