Avatar

Please consider registering
guest

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
Avatar
Francesco Zambon
Member
Members
Forum Posts: 83
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:
– 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

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

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

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

Dear Bjarne,

Thanks for your help.

Francesco.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
23 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: 735

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1523

Posts: 6449

Newest Members:

rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley, Thomassnism, biancacraft16

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0

Administrators: admin: 1