I'm relatively new to OPC-UA, I use C# to read/write data to Siemens PLC with OPC-UA protocol. I downloaded helper class (UAClientHelperAPI.cs) from Siemens site ad I use the ReadValues and WriteValues method from this class. In short: When I read values from a PLC from one supplier everythig is alright, I read the string and it is ok... insted, when I read from another PLC (supplied by another manufacturer) the strings contains a strange set of characters, like escape char. I read something like this: " \0J?@???@??\0\0\0\0 \0\0\0" or this " \0?\u0001\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0" but is super random... If I put this string in a TextBox visibile in the form, these characters are not displayed (I think beacause are escape characters or not visible). I tried many solutions.... like this
string result = null;
foreach (char c in input.ToCharArray())
{
var cat = char.GetUnicodeCategory(c);
if (cat == UnicodeCategory.UppercaseLetter ||
cat == UnicodeCategory.LowercaseLetter ||
cat == UnicodeCategory.DecimalDigitNumber ||
cat == UnicodeCategory.SpaceSeparator)
{
result += c;
}
}
But it only partially solves the problem, sometimes I find some Letter character which have nothing to do with my string.
is this by any chance something with unicode?
I don't have enough skills to solve this problem
Anyone can help me ?
I tryed many solutions but I can solve this problem