<rdar://problem/
5629995> Incorrect display of Danish characters on web site.
Test: http/tests/xmlhttprequest/response-encoding.html
* xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::didReceiveData):
Default to UTF-8 for HTML, too. It's unfortunate that we have to use different
rules for main content and XHR responses, but this matches both IE and Firefox.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28934
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-12-21 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Oliver.
+
+ <rdar://problem/5629995> Incorrect display of Danish characters on web site.
+
+ * http/tests/xmlhttprequest/resources/utf-8-no-charset.html: Added.
+ * http/tests/xmlhttprequest/response-encoding-expected.txt:
+ * http/tests/xmlhttprequest/response-encoding.html:
+
2007-12-20 Justin Garcia <justin.garcia@apple.com>
Reviewed by Oliver Hunt.
--- /dev/null
+<html>
+<body>Проверка</body>
+</html>
XML, koi8-r specified in XML declaration, but overridden by windows-1251 in overrideMimeType: Проверка. responseText: <?xml version="1.0" encoding="koi8-r"?> <node>Проверка</node>
XML transferred as text/plain, UTF-8 as default (ignore XML text declaration): <?xml version="1.0" encoding="koi8-r"?> <node>Проверка</node>
HTML, charset determined by a META: Проверка
+HTML, UTF-8 as default: Проверка
Async: Plain text, UTF-8 as default: Проверка
Async: Plain text, windows-1251 specified in HTTP headers: Проверка
Async: Plain text, windows-1251 specified in overrideMimeType: Проверка
Async: XML, koi8-r specified in XML declaration, but overridden by windows-1251 in overrideMimeType: Проверка. responseText: <?xml version="1.0" encoding="koi8-r"?> <node>Проверка</node>
Async: XML transferred as text/plain, UTF-8 as default (ignore XML text declaration): <?xml version="1.0" encoding="koi8-r"?> <node>Проверка</node>
Async: HTML, charset determined by a META: Проверка
+Async: HTML, UTF-8 as default: Проверка
log("Async: XML transferred as text/plain, UTF-8 as default (ignore XML text declaration): " + req.responseText);
get('resources/1251.html', true);
} else if (asyncStep == 10) {
+ asyncStep = 11;
log("Async: HTML, charset determined by a META: " + req.responseText.replace(/\s/g, "").replace(/.*<body>(.*)<\/body>.*/, "$1"));
+ get('resources/utf-8-no-charset.html', true);
+ } else if (asyncStep == 11) {
+ log("Async: HTML, UTF-8 as default: " + req.responseText.replace(/\s/g, "").replace(/.*<body>(.*)<\/body>.*/, "$1"));
}
} else {
log("Error loading URL: status " + req.status);
log("Exception: " + ex.description);
}
+ // 11
+ try {
+ req = get('resources/utf-8-no-charset.html', false);
+ log("HTML, UTF-8 as default: " + req.responseText.replace(/\s/g, "").replace(/.*<body>(.*)<\/body>.*/, "$1"));
+ } catch (ex) {
+ log("Exception: " + ex.description);
+ }
+
// start async steps
get('resources/reply.txt', true);
+2007-12-21 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Oliver.
+
+ <rdar://problem/5629995> Incorrect display of Danish characters on web site.
+
+ Test: http/tests/xmlhttprequest/response-encoding.html
+
+ * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::didReceiveData):
+ Default to UTF-8 for HTML, too. It's unfortunate that we have to use different
+ rules for main content and XHR responses, but this matches both IE and Firefox.
+
2007-12-20 Jon Honeycutt <jhoneycutt@apple.com>
Reviewed by Kevin Decker.
else if (responseIsXML())
m_decoder = new TextResourceDecoder("application/xml");
else if (responseMIMEType() == "text/html")
- m_decoder = new TextResourceDecoder("text/html");
+ m_decoder = new TextResourceDecoder("text/html", "UTF-8");
else
m_decoder = new TextResourceDecoder("text/plain", "UTF-8");
}