+2006-06-24 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Darin.
+
+ - http://bugzilla.opendarwin.org/show_bug.cgi?id=7461
+ Always encode the path part of an URI as UTF-8
+
+ * http/tests/uri/intercept/.htaccess: Added.
+ * http/tests/uri/resources/print-uri.php: Added.
+ * http/tests/uri/utf8-path-expected.txt: Added.
+ * http/tests/uri/utf8-path.html: Added.
+
2006-06-24 Graham Dennis <Graham.Dennis@gmail.com>
Reviewed by Darin, landed by ap.
--- /dev/null
+RewriteEngine on
+RewriteRule ^.* /uri/resources/print-uri.php [L,NS]
--- /dev/null
+<?php
+ header("Content-Type: text/javascript");
+ header("Expires: Thu, 01 Dec 2003 16:00:00 GMT\n");
+ header("Cache-Control: no-store, no-cache, must-revalidate\n");
+ header("Pragma: no-cache\n");
+ echo "document.write('" . $_SERVER['REQUEST_URI'] . "');";
+?>
--- /dev/null
+Test for bug 7461: Always encode the path part of an URI as UTF-8
+
+Test the URL as it is passed to the server. WinIE 6 and Firefox 3.0a results are currently diffrerent: IE uses the target encoding for the query path, while Firefox uses the page encoding. Also, WinIE doesn't percent-encode the query path.
+"/uri/intercept/print/%D1%84%D0%B0%D0%B9%D0%BB.js?%F7%E5%E9=%EC%EE%E9" (no target charset specified)
+"/uri/intercept/print/%D1%84%D0%B0%D0%B9%D0%BB.js?%F7%E5%E9=%EC%EE%E9" (target charset=windows-1251, same as page)
+"/uri/intercept/print/%D1%84%D0%B0%D0%B9%D0%BB.js?%F7%E5%E9=%EC%EE%E9" (target charset=iso-8859-5)
+
+Show the source attribute of the scripts. WinIE 6 doesn't use percent encoding here, while Firefox does.
+"http://127.0.0.1:8000/uri/intercept/print/%D1%84%D0%B0%D0%B9%D0%BB.js?%F7%E5%E9=%EC%EE%E9"
+"http://127.0.0.1:8000/uri/intercept/print/%D1%84%D0%B0%D0%B9%D0%BB.js?%F7%E5%E9=%EC%EE%E9"
+"http://127.0.0.1:8000/uri/intercept/print/%D1%84%D0%B0%D0%B9%D0%BB.js?%F7%E5%E9=%EC%EE%E9"
+
--- /dev/null
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
+</head>
+<body>
+
+<script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+</script>
+
+<p>Test for <a href='http://bugzilla.opendarwin.org/show_bug.cgi?id=7461'>bug 7461</a>:
+Always encode the path part of an URI as UTF-8</p>
+
+Test the URL as it is passed to the server. WinIE 6 and Firefox 3.0a results are currently diffrerent:
+IE uses the target encoding for the query path, while Firefox uses the page encoding. Also, WinIE doesn't percent-encode
+the query path.<br>
+"<script id=scr1 src="intercept/print/ôàéë.js?÷åé=ìîé"></script>" (no target charset specified)<br>
+"<script id=scr2 charset="windows-1251" src="intercept/print/ôàéë.js?÷åé=ìîé"></script>" (target charset=windows-1251, same as page)<br>
+"<script id=scr3 charset="iso-8859-5" src="intercept/print/ôàéë.js?÷åé=ìîé"></script>" (target charset=iso-8859-5)<br><br>
+
+Show the source attribute of the scripts. WinIE 6 doesn't use percent encoding here, while Firefox does.<br>
+<script>
+ try {
+ document.write('"' + document.scripts[1].src + '"<br>');
+ document.write('"' + document.scripts[2].src + '"<br>');
+ document.write('"' + document.scripts[3].src + '"<br>');
+ } catch (ex) {
+ document.write('"' + document.getElementById("scr1").src + '"<br>');
+ document.write('"' + document.getElementById("scr2").src + '"<br>');
+ document.write('"' + document.getElementById("scr3").src + '"<br>');
+ }
+</script>
+
+</body>
+</html>
+2006-06-24 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Darin.
+
+ - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7461
+ Always encode the path part of an URI as UTF-8
+
+ Test: http/tests/uri/utf8-path.html
+
+ * platform/KURL.cpp:
+ (encodeRelativeString): Always set pathEncoding to UTF-8.
+
2006-06-24 Graham Dennis <Graham.Dennis@gmail.com>
Reviewed by Darin, landed by ap.
char *strBuffer;
- static const WebCore::TextEncoding utf8Encoding(UTF8Encoding);
-
- WebCore::TextEncoding pathEncoding = encoding.isValid() ? encoding : utf8Encoding;
- WebCore::TextEncoding otherEncoding = pathEncoding;
-
- // Always use UTF-8 for mailto URLs because that's what mail applications expect.
- // Always use UTF-8 for paths in file and help URLs, since they are local filesystem paths,
- // and help content is often defined with this in mind, but use native encoding for the
- // non-path parts of the URL.
- if (pathEncoding != utf8Encoding) {
- DeprecatedString protocol;
- if (rel.length() > 0 && isSchemeFirstChar(rel.at(0).latin1())) {
- for (unsigned i = 1; i < rel.length(); i++) {
- char p = rel.at(i).latin1();
- if (p == ':') {
- protocol = rel.left(i);
- break;
- }
- if (!isSchemeChar(p)) {
- break;
- }
- }
- }
- if (!protocol) {
- protocol = base.protocol();
- }
- protocol = protocol.lower();
- if (protocol == "file" || protocol == "help") {
- pathEncoding = utf8Encoding;
- } else if (protocol == "mailto") {
- pathEncoding = utf8Encoding;
- otherEncoding = utf8Encoding;
- }
- }
+ WebCore::TextEncoding pathEncoding(UTF8Encoding);
+ WebCore::TextEncoding otherEncoding = encoding.isValid() ? encoding : WebCore::TextEncoding(UTF8Encoding);
int pathEnd = -1;
if (pathEncoding != otherEncoding) {