Re: need help withXMLHTTPreq and parsing response
Christian Biesinger <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Message-ID | <[email protected]> |
jason pollard wrote: > Oooooh (smacks forehead)......I was taking another look at this table. I > thought it'd be useless because it doesn't even go above 255 Well, bytes can only be in the range 0..255 :) >, but upon > looking at the x80 and x90 rows for one of my values, I noticed the win-1252 > code to be in the x2000's, and indeed these values map to the correct int > values I get using java's InputStream.read(). So all I have to do is build > a table to translate the characters in question, and I'm good to go. A > little more work than I wanted, but isn't it always? So my problem is > solved, I believe. Thanks for the help everybody. I guess the issue is that XMLHttpRequest was not designed for byte streams, but for textual data. Or actually XML Data I guess :-) > BTW, the overrideMimeType function is clearly ignored in this case, as we've > determined that the chars coming in are windows-1252. I don't quite understand why you expect the content type to affect the character set. > Why that is, I'm not > sure, but one thing I noticed, is that the other Western (ISO-8859-1 & 15 at > least) codepages don't have any characters defined for the x80s and 90s. > Why it doesn't just use UTF-8 I have no idea. UTF-8 would not help you at all. In fact, it would probably convert most bytes above 0x7F to U+FFFD, as they are not likely to be valid UTF-8 streams. The reason why the data is interpreted as windows-1252 is probably a) that mozilla falls back to the default encoding (ISO-8859-1) and b) that it treats windows-1252 and ISO-8859-1 as equivalent (i.e. the places where latin1 is undefined use the windows-1252 chars)