[Project_owners] Changing the encoding of a XMLHttpRequest
matthew at mjwilson.demon.co.uk
Tue Nov 9 07:43:43 EST 2004
Sudhakar Chandra wrote:
> I am working on a XUL News Aggregator  for Mozilla and Firefox. I use
> XMLHttpRequest to download the RSS/Atom/XML feed. How do I change the
> encoding of the responseXML into utf-8 and save the downloaded content
> into a file?
> For example, http://news.pathfinder.gr/rss/scitech/news.xml has the
> following header telling me what the encoding is:
> <?xml version="1.0" encoding="iso-8859-7" standalone="yes" ?>
> I can get the iso-8859-7 encoding through
> XMLHttpRequest.responseXML.characterSet. I want to convert this into
> UTF-8 and save it to a file. Can you give me a code snippet to do this?
You want to use DOMSerializer with the first argument as your document
(XMLHttprequest.responseXML), the second argument as some kind of file
output stream, and the third argument as "UTF-8".
File handling isn't my speciality so I'll leave someone else to fill in
More information about the Project_owners