Purpose
Specifies which character set MapBasic uses for interpreting character codes.
Syntax
CharSet char_set
char_set is a string that identifies the name of a character set; see table below.
Description
The CharSet clause specifies which character set MapBasic should use when reading or writing files or tables. Note that CharSet is a clause, not a complete statement. Various file-related statements, such as the Open File statement, can incorporate optional CharSet clauses.
What Is A Character Set?
Every character on a computer keyboard corresponds to a numeric code. For example, the letter "A" corresponds to the character code 65. A character set is a set of characters that appear on a computer, and a set of numeric codes that correspond to those characters.
Different character sets are used in different countries. For example, in the version of Windows for North America and Western Europe, character code 176 corresponds to a degrees symbol; however, if Windows is configured to use a different character set, character code 176 may represent a different character.
Call SystemInfo(SYS_INFO_CHARSET) to determine the character set in use at run-time.
How Do Character Sets Affect MapBasic Programs?
If your files use only standard ASCII characters in the range of 32 (space) to 126 (tilde), you do not need to worry about character set conflicts, and you do not need to use the CharSet clause.
Even if your files include "special" characters (for example, characters outside the range 32 to 126), if you do all of your work within one environment (e.g., Windows) using only one character set, you do not need to use the CharSet clause.
If your program needs to read an existing file that contains "special" characters, and if the file was created in a character set that does not match the character set in use when you run your program, your program should use the CharSet clause. The CharSet clause should indicate what character set was in use when the file was created.
The CharSet clause takes one parameter: a string expression which identifies the name of the character set to use. The following table lists all character sets available.
Character Set | Comments |
---|---|
"Neutral" | No character conversions performed. |
"ISO8859_1" | ISO 8859-1 (UNIX) |
"ISO8859_2" | ISO 8859-2 (UNIX) |
"ISO8859_3" | ISO 8859-3 (UNIX) |
"ISO8859_4" | ISO 8859-4 (UNIX) |
"ISO8859_5" | ISO 8859-5 (UNIX) |
"ISO8859_6" | ISO 8859-6 (UNIX) |
"ISO8859_7" | ISO 8859-7 (UNIX) |
"ISO8859_8" | ISO 8859-8 (UNIX) |
"ISO8859_9" | ISO 8859-9 (UNIX) |
"PackedEUCJapanese" | UNIX, standard Japanese implementation. |
"WindowsLatin2" "WindowsArabic" "WindowsCyrillic" "WindowsGreek" "WindowsHebrew" "WindowsTurkish" |
Windows Eastern Europe |
"WindowsTradChinese" | Windows Traditional Chinese |
"WindowsSimpChinese" | Windows Simplified Chinese |
"WindowsJapanese" | |
"WindowsKorean" | |
"CodePage437" | DOS Code Page 437 = IBM Extended ASCII |
"CodePage850" | DOS Code Page 850 = Multilingual |
"CodePage852" | DOS Code Page 852 = Eastern Europe |
"CodePage855" | DOS Code Page 855 = Cyrillic |
"CodePage857" | |
"CodePage860" | DOS Code Page 860 = Portuguese |
"CodePage861" | DOS Code Page 861 = Icelandic |
"CodePage863" | DOS Code Page 863 = French Canadian |
"CodePage864" | DOS Code Page 864 = Arabic |
"CodePage865" | DOS Code Page 865 = Nordic |
"CodePage869" | DOS Code Page 869 = Modern Greek |
"LICS" | Lotus worksheet release 1,2 character set |
"LMBCS" | Lotus worksheet release 3,4 character set |
"UTF-8" | Unicode character set (can be used in a Workspace, MapInfo Extended TAB file) |
"UTF-16" | Unicode character set (can be used in a Native Extended TAB file) |
Specify "UTF-8" for a workspace character set or Native Extended (NativeX) format table character set to allow characters from any language to be represented. It can also be used when importing, opening or registering a non-native table.
To set MapBasic to compile files and create executable application files (.mbx) in UTF-8 charset, start the MapBasic development environment from command line with the parameter -utf8 included.
To force MapInfo Pro to save a table in a specific character set, include a CharSet clause in the Commit Table statement.
See Also:
Commit Table statement, Create Table statement, Export statement, Open File statement, Register Table statement, Character Code Table Definitions