Tunghao / httpfox

Automatically exported from code.google.com/p/httpfox
GNU General Public License v2.0
0 stars 0 forks source link

Bad display for a UTF-16 XML from a UTF-8 document #116

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a utf-8 HTML page and a utf-16 XML document on your web server
2. Enable httpfox
3. From the page, the XML document using an Ajax call
4. Select the XML doc request and go to the tab "content"
4. Select "raw"

What is the expected output? What do you see instead?
Expected: see the pretty print of the xml and the raw display
Instead of the pretty print, I can see that

=== cut here ===

<?xml-stylesheet
href="chrome://global/locale/intl.css" type="text/css"
?>
<parsererror>
Erreur d'analyse XML : balise non fermée Emplacement : 
chrome://browser/content/browser.xul Numéro de ligne 1, Colonne 1 :
<sourcetext>< ^</sourcetext>
</parsererror>

=== cut here ===

Instead of the correct raw, I can see the XML BOM ("ÿþ"). I can see also each 
NUL character of the UTF-16 as a square (invalid character for the font I 
presume) on Windows.

What version of the product are you using? On what operating system?
- Firefox 10.0.2, Windows XP, Ubuntu 11.10 amd64
- httpfox 0.8.10

Please provide any additional information below.

If my web page is encoded using UTF-16 the display is correct. I used a XML BOM 
in each file.

Firebug has the same problem.

I noticed something strange with the data passed to «getPrettyPrintXML» 
(«httpfox.js»). If my HTML is encoded in UTF-16, then «xmlData» is what I 
expect (one character of the XML is one element of the string). If it uses 
UTF-8, then each element of the string is one byte of the XML. So I guess 
that's normal that I fails at some point (the XSLT I presume).

Original issue reported on code.google.com by fabie...@gmail.com on 26 Feb 2012 at 11:23

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Please find attached a test case.
ajax.html is utf-8
ajax2.html is utf-16

Original comment by fabie...@gmail.com on 26 Feb 2012 at 11:32

Attachments:

GoogleCodeExporter commented 8 years ago
I also let a comment for a Firebug issue:

https://code.google.com/p/fbug/issues/detail?id=1769

I also put the test case online (the requested XML is UTF-16 in both cases, the 
encodings of the calling pages are different; the code is very simple):

http://fabsk.eu/firebug/ajax-utf8.html (bad)
http://fabsk.eu/firebug/ajax-utf16.html (correct)

Original comment by fabie...@gmail.com on 26 Feb 2012 at 5:31