[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
cblu
cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:21:21 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 423d2dd72864ccdc547e016818c8fc371a1466ab
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Jan 8 23:07:53 2004 +0000
Fixed: <rdar://problem/3522900>: REGRESSION (100-117): Java plug-in description is garbled when displaying Plug-ins.html
Reviewed by darin.
* Misc.subproj/WebKitNSStringExtras.h:
* Misc.subproj/WebKitNSStringExtras.m:
(+[NSString _web_encodingForResource:]): new method, returns the encoding for a resource handle given its file system path
* Plugins.subproj/WebNetscapePluginPackage.m:
(-[WebNetscapePluginPackage stringForStringListID:andIndex:]): call _web_encodingForResource when creating the NSString
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5871 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index f994304..04076f2 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,15 @@
+2004-01-08 Chris Blumenberg <cblu at apple.com>
+
+ Fixed: <rdar://problem/3522900>: REGRESSION (100-117): Java plug-in description is garbled when displaying Plug-ins.html
+
+ Reviewed by darin.
+
+ * Misc.subproj/WebKitNSStringExtras.h:
+ * Misc.subproj/WebKitNSStringExtras.m:
+ (+[NSString _web_encodingForResource:]): new method, returns the encoding for a resource handle given its file system path
+ * Plugins.subproj/WebNetscapePluginPackage.m:
+ (-[WebNetscapePluginPackage stringForStringListID:andIndex:]): call _web_encodingForResource when creating the NSString
+
=== Safari-120 ===
2004-01-06 Richard Williamson <rjw at apple.com>
diff --git a/WebKit/Misc.subproj/WebKitNSStringExtras.h b/WebKit/Misc.subproj/WebKitNSStringExtras.h
index 26f93d8..66ecc54 100644
--- a/WebKit/Misc.subproj/WebKitNSStringExtras.h
+++ b/WebKit/Misc.subproj/WebKitNSStringExtras.h
@@ -20,4 +20,6 @@
- (NSString *)_web_stringByStrippingReturnCharacters;
++ (NSStringEncoding)_web_encodingForResource:(Handle)resource;
+
@end
diff --git a/WebKit/Misc.subproj/WebKitNSStringExtras.m b/WebKit/Misc.subproj/WebKitNSStringExtras.m
index 8761e67..9d79769 100644
--- a/WebKit/Misc.subproj/WebKitNSStringExtras.m
+++ b/WebKit/Misc.subproj/WebKitNSStringExtras.m
@@ -10,6 +10,8 @@
#import <WebCore/WebCoreUnicode.h>
+#import <Foundation/NSString_NSURLExtras.h>
+
@implementation NSString (WebKitExtras)
static BOOL canUseFastRenderer (const UniChar *buffer, unsigned length)
@@ -122,4 +124,55 @@ static BOOL canUseFastRenderer (const UniChar *buffer, unsigned length)
return newString;
}
++ (NSStringEncoding)_web_encodingForResource:(Handle)resource
+{
+ short resRef = HomeResFile(resource);
+ if (ResError() != noErr) {
+ return NSMacOSRomanStringEncoding;
+ }
+
+ // Get the FSRef for the current resource file
+ FSRef fref;
+ OSStatus error = FSGetForkCBInfo(resRef, 0, NULL, NULL, NULL, &fref, NULL);
+ if (error != noErr) {
+ return NSMacOSRomanStringEncoding;
+ }
+
+ CFURLRef URL = CFURLCreateFromFSRef(NULL, &fref);
+ if (URL == NULL) {
+ return NSMacOSRomanStringEncoding;
+ }
+
+ NSString *path = [(NSURL *)URL path];
+ CFRelease(URL);
+
+ // Get the lproj directory name
+ path = [path stringByDeletingLastPathComponent];
+ if (![[path pathExtension] _web_isCaseInsensitiveEqualToString:@"lproj"]) {
+ return NSMacOSRomanStringEncoding;
+ }
+
+ NSString *directoryName = [[path stringByDeletingPathExtension] lastPathComponent];
+ NSString *locale = (NSString *)CFLocaleCreateCanonicalLocaleIdentifierFromString(NULL, (CFStringRef)directoryName);
+ if (locale == nil) {
+ return NSMacOSRomanStringEncoding;
+ }
+
+ LangCode lang;
+ RegionCode region;
+ error = LocaleStringToLangAndRegionCodes([locale UTF8String], &lang, ®ion);
+ [locale release];
+ if (error != noErr) {
+ return NSMacOSRomanStringEncoding;
+ }
+
+ TextEncoding encoding;
+ error = UpgradeScriptInfoToTextEncoding(kTextScriptDontCare, lang, region, NULL, &encoding);
+ if (error != noErr) {
+ return NSMacOSRomanStringEncoding;
+ }
+
+ return CFStringConvertEncodingToNSStringEncoding(encoding);
+}
+
@end
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginPackage.m b/WebKit/Plugins.subproj/WebNetscapePluginPackage.m
index 4f30b06..56fb276 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginPackage.m
+++ b/WebKit/Plugins.subproj/WebNetscapePluginPackage.m
@@ -6,6 +6,7 @@
#import <WebKit/WebNetscapePluginPackage.h>
#import <WebKit/WebKitLogging.h>
+#import <WebKit/WebKitNSStringExtras.h>
#import <CoreFoundation/CFBundlePriv.h>
@@ -102,7 +103,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
p += 1 + *p;
// Convert the one we found into an NSString.
- return [[[NSString alloc] initWithBytes:(p + 1) length:*p encoding:NSMacOSRomanStringEncoding] autorelease];
+ return [[[NSString alloc] initWithBytes:(p + 1) length:*p encoding:[NSString _web_encodingForResource:stringHandle]] autorelease];
}
- (BOOL)getPluginInfoFromResources
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list