#159 Replace WSTRINGs with new SP18 UTF8 STRINGs

accepted
None
2022-06-10
2022-04-09
i-campbell
No

Currently we USE WSTRINGs throughout and convert to/from UTF8 for sending and receiving. This should be changed to use the new SP18 UTF8 STRINGs as described here: https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_utf8_encoding.html

Note that we have a Global Constant SUPPORTED_STRING_LENGTHS : DINT := 512;
That could hold 512 WCHARS, and takes 1026 Bytes of storage per string.
It can hold 512 2-Byte or 256 4-byte Unicode characters.
If we keep this value for UTF8 strings, each string would be 513 Bytes, and can hold 512 1-Byte or 85 6-Byte Unicode characters.

This improvement would halve the storage size for strings, and make converting payloads faster, and also things like string comparison and manipulation.

Discussion

  • hermsen

    hermsen - 2022-04-09

    Definitly worth the effort

     
  • i-campbell

    i-campbell - 2022-06-10

    Note Visualisation does not support these UTF8 strings until at least V4.3.0.0, maybe October.

     

Log in to post a comment.