11:31, EET
December 20, 2021
Good morning,
I am using the prosys-opc-ua-sdk-for-java-4.9.0-43-client-server-binary library.
I need to connect to an OPC UA server which can use the following character encodings:
– ASCII
– ISO/IEC 8859-1 (latin1)
– UTF8
Is it possible to set the character encoding of the Prosys client?
Can the client set the same encoding as the server automatically?
The default encoding should be UTF8 because it is the one defined in the specification:
https://reference.opcfoundation.org/Core/Part6/v104/5.2.2/
Thanks in advance for the support,
Francesco
13:28, EET
April 3, 2012
Hi,
That is an impossible server.
There is no “default encoding”, _it IS the only encoding_. As said in the spec you referred, https://reference.opcfoundation.org/Core/Part6/v104/5.2.2/:
“
5.2.2.4 String
All String values are encoded as a sequence of UTF-8 characters without a null terminator and preceded by the length in bytes.
“
There is no other encoding. This is the same for all spec versions, the text is basically unchanged from OPC UA spec version 1.00. Thus there is also no way to convey what the used encoding would have been (because there is only one option: UTF8). Thus, we only support UTF-8, as that is the only thing that needs to be supported.
Thus, this other server must be fixed to always sent UTF-8, it is not an OPC UA Server if it doesn’t use UTF-8.
Historically there is a so called “data encoding” information as part of ReadValueId, which can be set via UaClient. read(Double maxAge, TimestampsToReturn timestampsToReturn, ReadValueId… nodesToRead) (the raw-est read version), but still it is impossible to change the fact that the only supported encoding via Part 6 is UTF-8. To be honest, I have never see here anything, but null used. OK, I think this still wouldn’t be this, as it would basically only just allow historically to select do you want binary or XML representations of Structures (but in practice no-one started to support the XML encoding and thus binary is the only one people basically use).
This all is assuming we are talking about the String DataType. If the data is instead as a ByteString, it can be anything, though then you will also get the ByteString via the SDK, thus I assume this was not the case here..
Most Users Ever Online: 1919
Currently Online:
20 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 88
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 726
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1529
Posts: 6471
Newest Members:
gabriellabachus, Deakin, KTP25Zof, Wojciech Kubala, efrennowell431, wilfredostuart, caitlynfajardo, jeromechubb7, franciscagrimwad, adult_galleryModerators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0
Administrators: admin: 1