Using UTF-8 characters
Variables
TwinCAT uses the ISO/IEC 8859-1 character set by default. The TwinCAT IoT Communicator app, on the other hand, uses UTF-8 for decoding STRINGs.
The first 128 characters are the same for UTF-8 and ISO/IEC 8859-1. For all characters not contained in the first 128 characters, the following method must be applied to the STRING variable:
sMyUTF8Text : STRING := wsLiteral_TO_UTF8( "äöüßéèêµ€° Ἀθῆναι İstanbul Київ");
When used in arrays, the conversion must take place outside the array:
aData : ARRAY[0..2] OF STRING := ['Sample1', sMyUTF8Text, 'Sample2'];
It should be noted at this point that this conversion must also be taken into account in other program sequences.
Attributes
If special characters are to be used in the attributes, a check mark can be set for the UTF-8 encoding of the ADS symbols in TwinCAT Build 3.1.4024.
With TwinCAT 3.1.4026, this setting is set by default. Therefore, it no longer needs to be set manually by the user.