Re: IE error | Switch from current encoding to specifi
This is one way to do it. The source of the original problem was actually with the settings for the internal XML Writer, which defaults to UTF-16 (partially true, real UTF-16 is not supported by Microsoft, notably, MS does not support surrogate pairs) and if you "just" write the results of an XsltProcessor, it ends up being UTF-16.
By setting a custom writer with your properties, for the encoding you will effectively create the correct output stream in one go, without having to use Response.Write.Replace. I.e., in C# it looks a bit like this:
// instantiate an XmlWriter
XmlWriter xmlWriter = XmlWriter.Create("output.xml");
xmlWriter.Settings.Encoding = "UTF-8"; XslCompiledTransform xslt = new XslCompiledTransform(true);
// enable document function and scripting XsltSettings xsltSettings = new XsltSettings(true, true);
// load stylesheet and transform to "output.xml" (but you can use any stream)
xslt.Load("Xslt/test.xslt", xsltSettings, null);
xmlWriter = XmlWriter.Create("output.xml");
xslt.Transform("Xslt/test.xslt", xsltArgs, xmlWriter);
This is using the classes from ASP.NET 2.0 so you if you want to use this you may have to adjust it to your situation.
Cheers, -- Abel Braaksma
W Charlton wrote:
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format