[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
kocienda
kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:51:33 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit c51694461fc18516ee8b327d82e7308a432d2712
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Aug 13 20:48:16 2003 +0000
Reviewed by Darin
Fix for this bug:
<rdar://problem/3374458>: Choose UTF-8 for encoding when calling
CFURLCreateAbsoluteURLWithBytes in WebKit
Calling CFURLCreateAbsoluteURLWithBytes with ISO Latin 1 string
encoding results in some issues when trying to decode a URL path in
preparation for doing file I/O. Instead of doing a redecoding step
whenever a path is needed to perform I/O, use UTF-8 as the encoding
right from the start. This will mean that illegal UTF-8 sequences will
be rejected by CFURLCreateAbsoluteURLWithBytes. However, we can work
around this by falling back on ISO Latin1 in this case. The end result
is that existing code throughout the URL loading system can remain
unchanged and simply call the path method on NSURL as it does now and
get the right result for its I/O requirements.
* Misc.subproj/WebNSURLExtras.m:
(+[NSURL _web_URLWithData:relativeToURL:])
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4815 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 4cb64a4..f98d127 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -4,6 +4,29 @@
Fix for this bug:
+ <rdar://problem/3374458>: Choose UTF-8 for encoding when calling
+ CFURLCreateAbsoluteURLWithBytes in WebKit
+
+ Calling CFURLCreateAbsoluteURLWithBytes with ISO Latin 1 string
+ encoding results in some issues when trying to decode a URL path in
+ preparation for doing file I/O. Instead of doing a redecoding step
+ whenever a path is needed to perform I/O, use UTF-8 as the encoding
+ right from the start. This will mean that illegal UTF-8 sequences will
+ be rejected by CFURLCreateAbsoluteURLWithBytes. However, we can work
+ around this by falling back on ISO Latin1 in this case. The end result
+ is that existing code throughout the URL loading system can remain
+ unchanged and simply call the path method on NSURL as it does now and
+ get the right result for its I/O requirements.
+
+ * Misc.subproj/WebNSURLExtras.m:
+ (+[NSURL _web_URLWithData:relativeToURL:])
+
+2003-08-13 Ken Kocienda <kocienda at apple.com>
+
+ Reviewed by Darin
+
+ Fix for this bug:
+
<rdar://problem/3374487>: URLs with UTF-8 escape sequences can't be accessed
when typed in the Safari location bar
diff --git a/WebKit/Misc.subproj/WebNSURLExtras.m b/WebKit/Misc.subproj/WebNSURLExtras.m
index e2e7ccb..008a779 100644
--- a/WebKit/Misc.subproj/WebNSURLExtras.m
+++ b/WebKit/Misc.subproj/WebNSURLExtras.m
@@ -111,7 +111,15 @@ static char hexDigit(int i) {
NSURL *result = nil;
int length = [data length];
if (length > 0) {
- result = (NSURL *)CFURLCreateAbsoluteURLWithBytes(NULL, [data bytes], [data length], kCFStringEncodingISOLatin1, (CFURLRef)baseURL, YES);
+ const UInt8 *bytes = [data bytes];
+ // NOTE: We use UTF-8 here since this encoding is used when computing strings when returning URL components
+ // (e.g calls to NSURL -path). However, this function is not tolerant of illegal UTF-8 sequences, which
+ // could either be a malformed string or bytes in a different encoding, like shift-jis, so we fall back
+ // onto using ISO Latin 1 in those cases.
+ result = (NSURL *)CFURLCreateAbsoluteURLWithBytes(NULL, bytes, length, kCFStringEncodingUTF8, (CFURLRef)baseURL, YES);
+ if (!result) {
+ result = (NSURL *)CFURLCreateAbsoluteURLWithBytes(NULL, bytes, length, kCFStringEncodingISOLatin1, (CFURLRef)baseURL, YES);
+ }
[result autorelease];
}
else {
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list