Paster-Bachar Gadi · 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?


0 430
Discussion (1)1
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()
ENSEMBLE>set stream = ##class(%Stream.TmpCharacter).%New()

ENSEMBLE>write msg.OutputToLibraryStream(.stream)
ENSEMBLE>write stream.Read()