Re: need help withXMLHTTPreq and parsing response
Christian Biesinger <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Organization | Another Netscape Collabra Server User |
| Message-ID | <[email protected]> |
jason pollard wrote: > I just was looking for some rhyme or reason how > it's being converted, or why some bytes are converted to unicode, so that I > can convert back to bytes (acutally ints < 255). Ah. Well, I mentioned that the data is apparently interpreted as windows-1252, did I not? Just translate it back. See, for example, the table at http://www.microsoft.com/globaldev/reference/sbcs/1252.mspx > Could someone post a link > to the relevant source code? I took a look at the Mozilla repository, but > I'm not fluent in C so it didn't help at all. http://lxr.mozilla.org/seamonkey/source/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp#520 is where XMLHttpRequest converts the server data to unicode. Looks like all it does is get the charset from the HTTP response header, falling back to UTF-8. Although there's a harder case when there actually is an XML document object; I'm not sure how the charset detection happens then.