The locale encoding is still available as legacy mode for programs which expect
non-ASCII strings to be encoded in the current locale: on western (Windows)
systems, e.g., the program still expects tuple_ord to return the
CP1252 codes (the Euro sign is '128' instead of '8364' in Unicode mode) and
workarounds for Japanese encodings should work without changing the code.
The legacy mode can be enabled by setting the environment variable
HALCON_ENCODING to LOCALE or by using set_system:
set_system('filename_encoding', 'locale')
Applications that use the HALCON/C or the HALCON/C++ interface for calling
HALCON operators can also set the encoding of the interface independently of
the HALCON encoding.
However, the following encoding issues will probably not work as expected in
legacy encoding mode:
- Tuple string operators will not work character-wise.
They behave as old HALCON versions to keep the legacy mode working as before.
- Changing the filename encoding from 'utf8' to 'locale' or vice versa via
set_system does not work within JIT-compiled procedures.
The strings that are passed to the procedure are encoded according to the
filename encoding when entering the procedure.
String constants within the procedure are encoded according to the filename
encoding during the creation or last edit of the procedure.
This is no regression, i.e. the behavior can be observed also in HALCON 12 and 13.
- Error messages with non-ASCII characters were not and will not be
displayed correctly on non-latin systems, like Japanese Windows.
On Latin systems, only two English messages are affected:
H_ERR_CAL_NEGTS (8445) “Tilt must be within the range of
0° and 90°” and
H_ERR_CAL_NEGRS (8446) “Rot must be
within the range of 0° and 360°”.
German error messages with Umlauts will not be displayed correctly, too.
- On Japanese systems, the procedure list_image_files can
produce invalid paths if a path contains a Japanese character where the
second Shift-JIS byte has the same code as a backslash.
This is no regression, i. e. the behavior can be observed also in HALCON 12
and 13.
- The length passed to the operator read_string still limits the
number of bytes. This affects the number of Asian multi-byte characters that
effectively could be entered.
- The global system variables window_name and icon_name
are stored with the encoding of the HALCON library when they are set.
When the encoding is changed via set_system the names are not transcoded.
- All strings in HDevelop are always encoded in UTF-8, independently of the
filename encoding.
This implicates that it is not possible to create strings in legacy mode by
their local hexadecimal codes (instead of writing them as character, e.g.,
\ xe4 for the Latin-1 character “ä”).
The hexadecimal codes are not handled as the expected locale characters, but
they are first interpreted as UTF-8 bytes and only converted to local-8-bit
encoding when passed to the HALCON library.
Independently of the encoding mode, hostnames must be encoded in pure ASCII.
Special characters are not supported.
To query the hostname which is used, e.g., for socket connections, use:
get_system('hostname', Hostname)