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?

 

  • + 2
  • 0
  • 248
  • 0
  • 1

Answers

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>