Compiling in either UTF-8 or System Charset with MapBasic IDE - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Issue: Compiling with UTF-8 causes extended character strings to be incorrect.

MapBasic source files, such as *.mb, *.mbp, *.def, and *.txt, are created by default in the character set of the operating system. In MapBasic 15.2 and later they can be created and compiled as in the UTF-8 character set. MapBasic defaults to using the system character set for compiling and linking until you switch this setting on the File menu by selecting Charset or by changing it in the registry (Charset DWORD under HKEY_CURRENT_USER\Software\MapInfo\MapInfo\MapBasic).

If the source file is in the operating system character set (such as Windows Japanese) and you compile in MapBasic with the operating system character set, then the resulting MBX file uses characters in that locale as expected.

If you switch MapBasic to use the UTF-8 character set for compiling and the source file is encoded with a different character set, then the compiler does not do a conversion and the extended character strings in the source files are incorrect.

Fix: Only use the UTF-8 character set in MapBasic when the source file (*.MB or *.txt for example) is already in the UTF-8 encoding.