EDN Admin
Well-known member
I need to create an XML file in ISO 8859-1 format using XmlWriter.
While the XmlWriter encoding can be set using XmlWiterSettings Encoding property, the result is not the wanted. Unicode characters that is not valid in ISO 8859-1 is just encoded instead of converted, so when the recipient reads the file, he still receives
UNICODE characters.
I have dig around the runtime code using Reflector, and it seems the reason for this is that the XmlWriter creates a XmlEncodedRawtextWriter that handles the writing to the stream. As the name suggests, this one XML encodes high UNICODE characters.
What I need is a way to use XmlWriter to convert high UNICODE values instead of encoding them.
The XML output can get pretty big, so I cant use the obvious work-around solution where I use XmlWriter on a temporary memory stream, reading that to a string, convert that to a ISO 8859-1 char[] and finally outputting that the stream, that would use up
too much memory.
Please advice.
Regards;
/jb
View the full article
While the XmlWriter encoding can be set using XmlWiterSettings Encoding property, the result is not the wanted. Unicode characters that is not valid in ISO 8859-1 is just encoded instead of converted, so when the recipient reads the file, he still receives
UNICODE characters.
I have dig around the runtime code using Reflector, and it seems the reason for this is that the XmlWriter creates a XmlEncodedRawtextWriter that handles the writing to the stream. As the name suggests, this one XML encodes high UNICODE characters.
What I need is a way to use XmlWriter to convert high UNICODE values instead of encoding them.
The XML output can get pretty big, so I cant use the obvious work-around solution where I use XmlWriter on a temporary memory stream, reading that to a string, convert that to a ISO 8859-1 char[] and finally outputting that the stream, that would use up
too much memory.
Please advice.
Regards;
/jb
View the full article