Folks, I have a pair of utility methods that I wrote in Framework 1.0 that
"escapes" and "unescapes" non-ASCII strings so I can roundtrip them via
ASCII. So the string "ABC123ΑΒΓ" (last 3 chars are Greek) becomes
"ABC123\u0391\u0392\u0393" and I can later reverse it. This ancient manual
code must be redundant now. Is there a way of doing this in the FCL now? I
can't quickly find one.

 

Likewise, I'd like to be able to roundtrip arbitrary Unicode string via
encoding="ascii" XML with high characters converted to &# entities. I can't
find an automatic way of doing this either. If I save an XDocument in an
ASCII encoded TextWriter the high characters turn into question marks.

 

If I use utf-8 XML then it's okay as you can see the CE91CE92CE93 encoding
in the file.

 

Greg

Reply via email to