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
francescozambon
Member
Members
Forum Posts: 14
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: 860
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..

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 267

Currently Online:
16 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 124

pramanj: 86

ibrahim: 74

rocket science: 65

kapsl: 57

Sabari: 51

gjevremovic: 49

Xavier: 43

fred: 41

TimK: 41

Member Stats:

Guest Posters: 0

Members: 1749

Moderators: 15

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1323

Posts: 5649

Newest Members:

WalterFOUNC, datafastproxiespx01, LenkaLok, seoninet, justinevillanuev, namtrott5457, DonaldWibip, AlfredoEthix, andreidla, everangel7021

Moderators: Jouni Aro: 960, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 860, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 25, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 222, Lusetti: 0

Administrators: admin: 1