Please consider registering

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
manage character encodings client / server
November 24, 2022
11:31, EET
Francesco Zambon
Forum Posts: 78
Member Since:
December 20, 2021
sp_UserOfflineSmall Offline

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:
– 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:

Thanks in advance for the support,

November 24, 2022
13:28, EET
Bjarne Boström
Forum Posts: 954
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline


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/: 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..

December 13, 2022
10:47, EET
Francesco Zambon
Forum Posts: 78
Member Since:
December 20, 2021
sp_UserOfflineSmall Offline

Dear Bjarne,

Thanks for your help.


Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
15 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 130

pramanj: 86

Francesco Zambon: 78

ibrahim: 75

rocket science: 73

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

TimK: 41

Member Stats:

Guest Posters: 0

Members: 665

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1430

Posts: 6119

Newest Members:

sophiedavis, anitas, fakenatty, Negansaf, rheakempton93, JPasterkamp, mattiwenell, KevinGainy, jamiescooper, lonmackellar61

Moderators: Jouni Aro: 1002, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 954, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 297, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1