RESOLVED FIXED 16987
XMLHTTPRequest.responseText (text/html) without charset label does not inherit the referring page's charset
https://bugs.webkit.org/show_bug.cgi?id=16987
Summary XMLHTTPRequest.responseText (text/html) without charset label does not inheri...
Jungshik Shin
Reported 2008-01-23 13:36:54 PST
* How to reproduce 1. Go to http://i18nl10n.com/webkit/xhrtest.html * Expected (IE6, Firefox and Opera all do this) Both columns should be identical with two lines of the first 5 letters of Cyrillic alphabet * Actual The 2nd line in the right column (text/html) has 'gibberish' rather than the first 5 letters of Cyrillic alphabet. The left column ( http://i18nl10n.com/webkit/xhrtest1.html with meta for UTF-8) loads xhrtestdata1.txt (encoded in UTF-8 and emitted with HTTP header : Content-Type: text/plain) while the right column (http://i18nl10n.com/webkit/xhrtest2.html : with meta for UTF-8) loads xhrtestdata2.html (encoded in UTF-8 without meta and emitted with HTTP header : 'Content-Type: text/html') Neither xhrtestdata1.txt nor xhrtestdata2.html has 'UTF-8 BOM'.
Attachments
Jungshik Shin
Comment 1 2008-01-23 13:39:17 PST
I forgot to mention that the gibberish is the result of interpreting the 1st 5 Cyrillic letters in UTF-8 as ISO-8859-1 (the default encoding). There can be other variations of these two test cases.
Jungshik Shin
Comment 2 2008-01-23 13:51:24 PST
sorry for bug spam. (In reply to comment #1) > I forgot to mention that the gibberish is the result of interpreting the 1st 5 > Cyrillic letters in UTF-8 as ISO-8859-1 (the default encoding). s/ISO-8859-1/Windows-1252/
Eric Seidel (no email)
Comment 3 2008-01-23 15:12:58 PST
This fails for me on 3.0.4 (mac), however it works on TOT. I think this bug was fixed already, not sure where.
Eric Seidel (no email)
Comment 4 2008-01-23 15:19:24 PST
Fails in the latest Windows beta. This is the file which would have changed: http://trac.webkit.org/projects/webkit/log/trunk/WebCore/xml/XMLHttpRequest.cpp A quick scan didn't find the change. However, I think we can still close this as "Fixed".
Jungshik Shin
Comment 5 2008-01-23 18:47:52 PST
It's 'fixed' in http://trac.webkit.org/projects/webkit/browser/trunk/WebCore/xml/XMLHttpRequest.cpp?rev=28934 However, I'm not sure that change is the 'right' thing to do. I'll make another test case and see what happens.
Jungshik Shin
Comment 6 2008-01-23 20:38:17 PST
I was wrong to think that 'text/html'(without charset specified anywhere) obtained through XHR inherits charset from the referring document in FF and IE. ap's change makes webkit compatible with FF and IE.
Jungshik Shin
Comment 7 2008-01-23 20:40:12 PST
(In reply to comment #6) > ap's change makes webkit compatible with FF and IE. Which assumes UTF-8 when charset is not specified.
Note You need to log in before you can comment on or make changes to this bug.