inosik opened a new issue, #703:
URL: https://github.com/apache/plc4x/issues/703

   I noticed that PLC4X uses UTF-8 encoding to read/write strings to ADS 
devices. According to [Beckhoffs 
documentation](https://infosys.beckhoff.com/content/1033/tc3_plc_intro/2529327243.html?id=4470464088993876920),
 the correct encoding for `STRING` variables is Windows-1252. I created a demo 
program in TwinCAT 3, with a string value being set to the Euro-sign:
   
   
![VirtualBoxVM_2022-12-07_11-23-16](https://user-images.githubusercontent.com/11393003/208423591-6e78d420-1934-4c9a-8a74-9aa8c90fedc2.png)
   
   
![VirtualBoxVM_2022-12-07_11-24-45](https://user-images.githubusercontent.com/11393003/208423644-949f798e-7b2f-4b41-a85e-1a202cfe0be2.png)
   
   _Note: `BinaryString8` is a union type, consisting of a string and a byte 
array, which allows me to see the binary data representing the string. For 
comparison, there's also a version with a `WSTRING`, which is encoded using 
UTF-16._
   
   As you can see, the Euro-sign is encoded as 128 (`0x80`), while [in UTF-8 it 
should be 
`0xe282ac`](https://www.fileformat.info/info/unicode/char/20ac/index.htm).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to