Question
· Aug 5, 2016

Using streams with Russian language

Hello, guys.

I need to copy the text from one stream to another filestream and save it. I am using  

do fileStream.CopyFromAndSave(rtn.Code)

However, if "rtn" stream contains Russian characters I get something like "???". Is there any way to convert stream to Unicode?  Something like $zc(str, "O", "UTF8") for streams.

Discussion (3)0
Log in or sign up to continue

For file character streams you need to specify TranslateTable property, which is internal translation table based on your locale. 

For translation to utf-8 you need to set:

 set  fileStream   ##class( %FileCharacterStream). %New()
 set  fileStream .Filename  fileLocation

 set fileStream .TranslateTable ="UTF8"

 set status  fileStream .CopyFromAndSave (rtn .Code )

It should help.