<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre, #msg p { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[28934] trunk</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/28934">28934</a></dd>
<dt>Author</dt> <dd>ap@webkit.org</dd>
<dt>Date</dt> <dd>2007-12-21 03:00:42 -0800 (Fri, 21 Dec 2007)</dd>
</dl>

<h3>Log Message</h3>
<pre>        Reviewed by Oliver.

        &lt;rdar://problem/5629995&gt; 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.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestshttptestsxmlhttprequestresponseencodingexpectedtxt">trunk/LayoutTests/http/tests/xmlhttprequest/response-encoding-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsxmlhttprequestresponseencodinghtml">trunk/LayoutTests/http/tests/xmlhttprequest/response-encoding.html</a></li>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCorexmlXMLHttpRequestcpp">trunk/WebCore/xml/XMLHttpRequest.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestsxmlhttprequestresourcesutf8nocharsethtml">trunk/LayoutTests/http/tests/xmlhttprequest/resources/utf-8-no-charset.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (28933 => 28934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2007-12-21 10:57:36 UTC (rev 28933)
+++ trunk/LayoutTests/ChangeLog        2007-12-21 11:00:42 UTC (rev 28934)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2007-12-21  Alexey Proskuryakov  &lt;ap@webkit.org&gt;
+
+        Reviewed by Oliver.
+
+        &lt;rdar://problem/5629995&gt; 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:
+
</ins><span class="cx"> 2007-12-20  Justin Garcia  &lt;justin.garcia@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Oliver Hunt.
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsxmlhttprequestresourcesutf8nocharsethtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/xmlhttprequest/resources/utf-8-no-charset.html (0 => 28934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/xmlhttprequest/resources/utf-8-no-charset.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/resources/utf-8-no-charset.html        2007-12-21 11:00:42 UTC (rev 28934)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+&lt;html&gt;
+&lt;body&gt;Проверка&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">Property changes on: trunk/LayoutTests/http/tests/xmlhttprequest/resources/utf-8-no-charset.html
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:mime-type
</span><span class="cx">   + text/html
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsxmlhttprequestresponseencodingexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/xmlhttprequest/response-encoding-expected.txt (28933 => 28934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/xmlhttprequest/response-encoding-expected.txt        2007-12-21 10:57:36 UTC (rev 28933)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/response-encoding-expected.txt        2007-12-21 11:00:42 UTC (rev 28934)
</span><span class="lines">@@ -10,6 +10,7 @@
</span><span class="cx"> XML, koi8-r specified in XML declaration, but overridden by windows-1251 in overrideMimeType: Проверка. responseText: &lt;?xml version=&quot;1.0&quot; encoding=&quot;koi8-r&quot;?&gt; &lt;node&gt;Проверка&lt;/node&gt;
</span><span class="cx"> XML transferred as text/plain, UTF-8 as default (ignore XML text declaration): &lt;?xml version=&quot;1.0&quot; encoding=&quot;koi8-r&quot;?&gt; &lt;node&gt;Проверка&lt;/node&gt;
</span><span class="cx"> HTML, charset determined by a META: Проверка
</span><ins>+HTML, UTF-8 as default: Проверка
</ins><span class="cx"> Async: Plain text, UTF-8 as default: Проверка
</span><span class="cx"> Async: Plain text, windows-1251 specified in HTTP headers: Проверка
</span><span class="cx"> Async: Plain text, windows-1251 specified in overrideMimeType: Проверка
</span><span class="lines">@@ -20,3 +21,4 @@
</span><span class="cx"> Async: XML, koi8-r specified in XML declaration, but overridden by windows-1251 in overrideMimeType: Проверка. responseText: &lt;?xml version=&quot;1.0&quot; encoding=&quot;koi8-r&quot;?&gt; &lt;node&gt;Проверка&lt;/node&gt;
</span><span class="cx"> Async: XML transferred as text/plain, UTF-8 as default (ignore XML text declaration): &lt;?xml version=&quot;1.0&quot; encoding=&quot;koi8-r&quot;?&gt; &lt;node&gt;Проверка&lt;/node&gt;
</span><span class="cx"> Async: HTML, charset determined by a META: Проверка
</span><ins>+Async: HTML, UTF-8 as default: Проверка
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsxmlhttprequestresponseencodinghtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/xmlhttprequest/response-encoding.html (28933 => 28934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/xmlhttprequest/response-encoding.html        2007-12-21 10:57:36 UTC (rev 28933)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/response-encoding.html        2007-12-21 11:00:42 UTC (rev 28934)
</span><span class="lines">@@ -112,7 +112,11 @@
</span><span class="cx">              log(&quot;Async: XML transferred as text/plain, UTF-8 as default (ignore XML text declaration): &quot; + req.responseText);
</span><span class="cx">              get('resources/1251.html', true);
</span><span class="cx">            } else if (asyncStep == 10) {
</span><ins>+             asyncStep = 11;
</ins><span class="cx">              log(&quot;Async: HTML, charset determined by a META: &quot; + req.responseText.replace(/\s/g, &quot;&quot;).replace(/.*&lt;body&gt;(.*)&lt;\/body&gt;.*/, &quot;$1&quot;));
</span><ins>+             get('resources/utf-8-no-charset.html', true);
+           } else if (asyncStep == 11) {
+             log(&quot;Async: HTML, UTF-8 as default: &quot; + req.responseText.replace(/\s/g, &quot;&quot;).replace(/.*&lt;body&gt;(.*)&lt;\/body&gt;.*/, &quot;$1&quot;));
</ins><span class="cx">            }
</span><span class="cx">         } else {
</span><span class="cx">            log(&quot;Error loading URL: status &quot; + req.status);
</span><span class="lines">@@ -202,6 +206,14 @@
</span><span class="cx">         log(&quot;Exception: &quot; + ex.description);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // 11
+    try {
+        req =  get('resources/utf-8-no-charset.html', false);
+        log(&quot;HTML, UTF-8 as default: &quot; + req.responseText.replace(/\s/g, &quot;&quot;).replace(/.*&lt;body&gt;(.*)&lt;\/body&gt;.*/, &quot;$1&quot;));
+    } catch (ex) {
+        log(&quot;Exception: &quot; + ex.description);
+    }
+
</ins><span class="cx">     // start async steps
</span><span class="cx">     get('resources/reply.txt', true);
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (28933 => 28934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2007-12-21 10:57:36 UTC (rev 28933)
+++ trunk/WebCore/ChangeLog        2007-12-21 11:00:42 UTC (rev 28934)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2007-12-21  Alexey Proskuryakov  &lt;ap@webkit.org&gt;
+
+        Reviewed by Oliver.
+
+        &lt;rdar://problem/5629995&gt; 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.
+
</ins><span class="cx"> 2007-12-20  Jon Honeycutt  &lt;jhoneycutt@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Kevin Decker.
</span></span></pre></div>
<a id="trunkWebCorexmlXMLHttpRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/xml/XMLHttpRequest.cpp (28933 => 28934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/xml/XMLHttpRequest.cpp        2007-12-21 10:57:36 UTC (rev 28933)
+++ trunk/WebCore/xml/XMLHttpRequest.cpp        2007-12-21 11:00:42 UTC (rev 28934)
</span><span class="lines">@@ -729,7 +729,7 @@
</span><span class="cx">         else if (responseIsXML())
</span><span class="cx">             m_decoder = new TextResourceDecoder(&quot;application/xml&quot;);
</span><span class="cx">         else if (responseMIMEType() == &quot;text/html&quot;)
</span><del>-            m_decoder = new TextResourceDecoder(&quot;text/html&quot;);
</del><ins>+            m_decoder = new TextResourceDecoder(&quot;text/html&quot;, &quot;UTF-8&quot;);
</ins><span class="cx">         else
</span><span class="cx">             m_decoder = new TextResourceDecoder(&quot;text/plain&quot;, &quot;UTF-8&quot;);
</span><span class="cx">     }
</span></span></pre>
</div>
</div>

</body>
</html>