Question
· Sep 27, 2016

XMLObject.OutputToString and Hebrew

 

We are using object EnsLib.EDI.XML.Document and the method OutputToString -- ( context.XMLObject.OutputToString("C(utf-8)") ), In the string that we get back, Hebrew characters are unknown and we get question mark instead.

 

How can we overcome it?

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

I am seeing the same thing.  OutputToString() internally uses OutputToIOStream() but it sets the CharEncoding on the stream to "binary" before passing it.  I think this is the source of the problem.

I was able to work around it using OutputToLibraryStream instead:

ENSEMBLE>set msg = ##class(EnsLib.EDI.XML.Document).ImportFromString("<Test>מִבְחָן</Test>")

ENSEMBLE>write msg.OutputToString()
<Test>???????</Test>
ENSEMBLE>set stream = ##class(%Stream.TmpCharacter).%New()

ENSEMBLE>write msg.OutputToLibraryStream(.stream)
1
ENSEMBLE>write stream.Read()
<Test>מִבְחָן</Test>