Data can be stored in UTF-8 format when working with the WSTRING type in the IEC code.
By using the ConvertUTF16toUTF8 function from the StringUtiIs library, the text is converted to UTF-8 format and can be saved to a file.
- Create a "Standard project" and select CODESYS Control Win V3 as the device.
- Define the target system by means of the Network scan.
- Open the Library Manager and add the following libraries:
Edit the PLC_PRG POU as follows:
- Start the project and set the xWrite variable to TRUE.
If the file is viewed in an editor, then the text is displayed correctly: