[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:21:30 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 824a36ef9097268166abece9cd6dad9be82427e7
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jun 26 19:01:59 2002 +0000

    	- fixed 2969378 -- "A with hat" characters (Unicode 00C2) showing up at Zingermans.com
    
            * kwq/KWQCharsets.mm: (buildDictionaries): Put UTF-16 in the dictionary, but pointing
    	at the string encoding for UTF-8. This mimics what Internet Explorer does.
    
            * kwq/KWQtextcodec.mm: (QTextCodec::fromUnicode): Fix implementation so it will convert
    	the specified encoding instead of always Latin-1.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1441 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index b8e3ea1..355ecea 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,5 +1,15 @@
 2002-06-26  Darin Adler  <darin at apple.com>
 
+	- fixed 2969378 -- "A with hat" characters (Unicode 00C2) showing up at Zingermans.com
+
+        * kwq/KWQCharsets.mm: (buildDictionaries): Put UTF-16 in the dictionary, but pointing
+	at the string encoding for UTF-8. This mimics what Internet Explorer does.
+
+        * kwq/KWQtextcodec.mm: (QTextCodec::fromUnicode): Fix implementation so it will convert
+	the specified encoding instead of always Latin-1.
+
+2002-06-26  Darin Adler  <darin at apple.com>
+
 	Fixed (or at least worked around) a crash I saw where KWQKHTMLPartImpl::end was
         making calls after the KHTMLView was gone. This is specific to our APPLE_CHANGES
         code; it's handled differently in KDE.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index b8e3ea1..355ecea 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,15 @@
 2002-06-26  Darin Adler  <darin at apple.com>
 
+	- fixed 2969378 -- "A with hat" characters (Unicode 00C2) showing up at Zingermans.com
+
+        * kwq/KWQCharsets.mm: (buildDictionaries): Put UTF-16 in the dictionary, but pointing
+	at the string encoding for UTF-8. This mimics what Internet Explorer does.
+
+        * kwq/KWQtextcodec.mm: (QTextCodec::fromUnicode): Fix implementation so it will convert
+	the specified encoding instead of always Latin-1.
+
+2002-06-26  Darin Adler  <darin at apple.com>
+
 	Fixed (or at least worked around) a crash I saw where KWQKHTMLPartImpl::end was
         making calls after the KHTMLView was gone. This is specific to our APPLE_CHANGES
         code; it's handled differently in KDE.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index b8e3ea1..355ecea 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,15 @@
 2002-06-26  Darin Adler  <darin at apple.com>
 
+	- fixed 2969378 -- "A with hat" characters (Unicode 00C2) showing up at Zingermans.com
+
+        * kwq/KWQCharsets.mm: (buildDictionaries): Put UTF-16 in the dictionary, but pointing
+	at the string encoding for UTF-8. This mimics what Internet Explorer does.
+
+        * kwq/KWQtextcodec.mm: (QTextCodec::fromUnicode): Fix implementation so it will convert
+	the specified encoding instead of always Latin-1.
+
+2002-06-26  Darin Adler  <darin at apple.com>
+
 	Fixed (or at least worked around) a crash I saw where KWQKHTMLPartImpl::end was
         making calls after the KHTMLView was gone. This is specific to our APPLE_CHANGES
         code; it's handled differently in KDE.
diff --git a/WebCore/kwq/KWQCharsets.mm b/WebCore/kwq/KWQCharsets.mm
index 474d0a3..b1db770 100644
--- a/WebCore/kwq/KWQCharsets.mm
+++ b/WebCore/kwq/KWQCharsets.mm
@@ -26,11 +26,11 @@
 #import "KWQCharsets.h"
 #import <CoreFoundation/CoreFoundation.h>
 
-typedef struct CharsetEntry {
-  const char *name;
-  int mib;
-  CFStringEncoding encoding;;
-} CharsetEntry;
+struct CharsetEntry {
+    const char *name;
+    int mib;
+    CFStringEncoding encoding;
+};
 
 
 /* The following autogenerated file includes the charset data. */
@@ -41,7 +41,6 @@ static CFMutableDictionaryRef mibToEncoding = NULL;
 static CFMutableDictionaryRef encodingToName = NULL;
 static CFMutableDictionaryRef encodingToMIB = NULL;
 
-
 static void buildDictionaries (void)
 {
   int i;
@@ -57,8 +56,8 @@ static void buildDictionaries (void)
     name = CFStringCreateWithCString(NULL, table[i].name, kCFStringEncodingASCII);
 
     if (name != NULL) {
-      CFDictionarySetValue(nameToEncoding, (void *) name, (void *) table[i].encoding);
-      CFDictionarySetValue(encodingToName, (void *) table[i].encoding, (void *) name);
+      CFDictionarySetValue(nameToEncoding, name, (void *) table[i].encoding);
+      CFDictionarySetValue(encodingToName, (void *) table[i].encoding, name);
     }
 
     if (table[i].mib != -1) {
@@ -66,6 +65,11 @@ static void buildDictionaries (void)
       CFDictionarySetValue(encodingToMIB, (void *) table[i].encoding, (void *) table[i].mib);
     }
   }
+  
+  // Add special bogus entry to make UTF-16 mean UTF-8.
+  // We do this because Internet Explorere does, and because web pages say UTF-16 and mean UTF-8.
+  // See bug 2969378 and http://zingermans.com/ for a concrete example.
+  CFDictionarySetValue(nameToEncoding, CFSTR("utf-16"), (void *) kCFStringEncodingUTF8);
 }
 
 CFStringEncoding KWQCFStringEncodingFromIANACharsetName(CFStringRef charsetName)
diff --git a/WebCore/kwq/KWQTextCodec.mm b/WebCore/kwq/KWQTextCodec.mm
index a65e7f7..6da26c7 100644
--- a/WebCore/kwq/KWQTextCodec.mm
+++ b/WebCore/kwq/KWQTextCodec.mm
@@ -65,7 +65,7 @@ QTextCodec *QTextCodec::codecForName(const char *name, int accuracy)
 {
     CFStringRef cfname;
     CFStringEncoding encoding;
-
+    
     cfname = CFStringCreateWithCString(NULL, name, kCFStringEncodingASCII);
 
     encoding = KWQCFStringEncodingFromIANACharsetName(cfname);
@@ -90,7 +90,7 @@ const char *QTextCodec::name() const
 
 int QTextCodec::mibEnum() const
 {
-  return KWQCFStringEncodingToMIB(encoding);
+    return KWQCFStringEncodingToMIB(encoding);
 }
 
 QTextDecoder *QTextCodec::makeDecoder() const
@@ -100,7 +100,14 @@ QTextDecoder *QTextCodec::makeDecoder() const
 
 QCString QTextCodec::fromUnicode(const QString &qcs) const
 {
-    return QCString(qcs.latin1());
+    CFStringRef cfs = qcs.getCFMutableString();
+    CFRange range = CFRangeMake(0, CFStringGetLength(cfs));
+    CFIndex bufferLength;
+    CFStringGetBytes(cfs, range, encoding, '?', false, NULL, 0x7FFFFFFF, &bufferLength);
+    QCString result(bufferLength + 1);
+    CFStringGetBytes(cfs, range, encoding, '?', false, (UInt8 *)result.data(), bufferLength, &bufferLength);
+    result[bufferLength] = 0;
+    return result;
 }
 
 QString QTextCodec::toUnicode(const char *chs, int len) const

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list