PIServer.CreatePIPoints and CodePage-866 Cyrillic characters

Discussion created by seneschal on Jan 28, 2014
Latest reply on Jan 30, 2014 by Bannikov



I have a customer from Russia who has requested that we support older CP-866 and CP-1251 encodings. In essence, I have to read in some files created with these encodings, and create PI tags with the names I find.


I successfully parsed the files using CP-866 and got a Cyrillic string back in C#. I then attempted to create the PI Tag using this string, but CreatePiTags gives back the error "[-10551] Invalid Characters in Tag".


As I understand it, once C# reads in the CP-866 data, any internal strings are stored as Unicode-16, so this should not be an issue. Is PI Server preventing the creation of PI tags using nonstandard Unicode characters?  Or is it failing because I am using an American English version?


This is a representation of what I am trying to do.

List<string> pointNames = new List<string>();
Encoding encoding = Encoding.GetEncoding(866);
using (StreamReader sr = new StreamReader(cfgFile, encoding))
  while ((line = sr.ReadLine()) != null)
  results = piServer.CreatePIPoints(pointNames, m_pointAttributes);



Before I was asked to support these code pages, I used to just use "Default" encoding. When the files were read in, I got strings back that looked like 

"2502€ –¨äà®¢ë¥ § é¨âë 6476,731"

 but this worked fine - I was able to create PI Tags with this wacky character set.  Obviously thats not super helpful to the customer though.