[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 07:36:39 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit d65913b579c0f360c03c178a9458c74b3b05d5c7
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Apr 11 23:30:59 2003 +0000

            Reviewed by Richard.
    
    	- fixed 3225472 -- www.sina.com.cn uses A3A0 for full-width space; used to work in Simplified Chinese (Mac OS)
    
            * kwq/KWQTextCodec.mm: (KWQTextDecoder::convertUsingTEC): Work around the problem
            in the Text Encoding Converter by changing all U+E5E5 to U+3000.
    
            * kwq/KWQString.h: Added replace(QChar, QChar), since Qt has it and I need it.
            * kwq/KWQString.mm:
            (QString::find): Fixed a bug where we'd yield a FATAL and return -1 on deployment
            if you searched for a non-ASCII character in a string that had ASCII valid and
            not Unicode valid.
            (QString::replace): Added replace(QChar, QChar).
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4083 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 1113bd8..d9f1471 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,19 @@
+2003-04-11  Darin Adler  <darin at apple.com>
+
+        Reviewed by Richard.
+
+	- fixed 3225472 -- www.sina.com.cn uses A3A0 for full-width space; used to work in Simplified Chinese (Mac OS)
+
+        * kwq/KWQTextCodec.mm: (KWQTextDecoder::convertUsingTEC): Work around the problem
+        in the Text Encoding Converter by changing all U+E5E5 to U+3000.
+
+        * kwq/KWQString.h: Added replace(QChar, QChar), since Qt has it and I need it.
+        * kwq/KWQString.mm:
+        (QString::find): Fixed a bug where we'd yield a FATAL and return -1 on deployment
+        if you searched for a non-ASCII character in a string that had ASCII valid and
+        not Unicode valid.
+        (QString::replace): Added replace(QChar, QChar).
+        
 === Safari-73 ===
 
 2003-04-10  Trey Matteson  <trey at apple.com>
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 1113bd8..d9f1471 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,19 @@
+2003-04-11  Darin Adler  <darin at apple.com>
+
+        Reviewed by Richard.
+
+	- fixed 3225472 -- www.sina.com.cn uses A3A0 for full-width space; used to work in Simplified Chinese (Mac OS)
+
+        * kwq/KWQTextCodec.mm: (KWQTextDecoder::convertUsingTEC): Work around the problem
+        in the Text Encoding Converter by changing all U+E5E5 to U+3000.
+
+        * kwq/KWQString.h: Added replace(QChar, QChar), since Qt has it and I need it.
+        * kwq/KWQString.mm:
+        (QString::find): Fixed a bug where we'd yield a FATAL and return -1 on deployment
+        if you searched for a non-ASCII character in a string that had ASCII valid and
+        not Unicode valid.
+        (QString::replace): Added replace(QChar, QChar).
+        
 === Safari-73 ===
 
 2003-04-10  Trey Matteson  <trey at apple.com>
diff --git a/WebCore/kwq/KWQString.h b/WebCore/kwq/KWQString.h
index e5fa183..c5dc133 100644
--- a/WebCore/kwq/KWQString.h
+++ b/WebCore/kwq/KWQString.h
@@ -457,6 +457,7 @@ public:
     QString &remove(uint, uint);
     QString &replace(uint index, uint len, const QString &s);
     QString &replace(const QRegExp &, const QString &);
+    QString &replace(QChar, QChar);
 
     void truncate(uint);
     void fill(QChar, int len=-1);
diff --git a/WebCore/kwq/KWQString.mm b/WebCore/kwq/KWQString.mm
index 2dbbdf9..9f58338 100644
--- a/WebCore/kwq/KWQString.mm
+++ b/WebCore/kwq/KWQString.mm
@@ -984,15 +984,13 @@ bool QString::isNull() const
 
 int QString::find(QChar qc, int index) const
 {
-    if (IS_ASCII_QCHAR(qc) && dataHandle[0]->_isAsciiValid)
+    if (dataHandle[0]->_isAsciiValid) {
+        if (!IS_ASCII_QCHAR(qc)) {
+            return -1;
+        }
         return find((char)qc, index);
-    else if (dataHandle[0]->_isUnicodeValid)
-        return find(QString(qc), index, TRUE);
-    else
-        FATAL("invalid character cache");
-
-    // Should never get here.  Needed for compiler.
-    return -1;
+    }
+    return find(QString(qc), index, true);
 }
 
 int QString::find(char ch, int index) const
@@ -2323,6 +2321,37 @@ QString &QString::replace(const QRegExp &qre, const QString &str)
 }
 
 
+QString &QString::replace(QChar oldChar, QChar newChar)
+{
+    if (find(oldChar) != -1) {
+        unsigned length = dataHandle[0]->_length;
+        
+        detach();
+        if (dataHandle[0]->_isAsciiValid && IS_ASCII_QCHAR(newChar)) {
+            char *p = const_cast<char *>(ascii());
+            dataHandle[0]->_isUnicodeValid = 0;
+            char oldC = oldChar;
+            char newC = newChar;
+            for (unsigned i = 0; i != length; ++i) {
+                if (p[i] == oldC) {
+                    p[i] = newC;
+                }
+            }
+        } else {
+            QChar *p = const_cast<QChar *>(unicode());
+            dataHandle[0]->_isAsciiValid = 0;
+            for (unsigned i = 0; i != length; ++i) {
+                if (p[i] == oldChar) {
+                    p[i] = newChar;
+                }
+            }
+        }
+    }
+    
+    return *this;
+}
+
+
 QChar *QString::forceUnicode()
 {
     detach();
diff --git a/WebCore/kwq/KWQTextCodec.mm b/WebCore/kwq/KWQTextCodec.mm
index f8057ec..2c5c8db 100644
--- a/WebCore/kwq/KWQTextCodec.mm
+++ b/WebCore/kwq/KWQTextCodec.mm
@@ -372,6 +372,14 @@ QString KWQTextDecoder::convertUsingTEC(const UInt8 *chs, int len, bool flush)
         }
     }
     
+    // Workaround for a bug in the Text Encoding Converter (see bug 3225472).
+    // Simplified Chinese pages use the code U+A3A0 to mean "full-width space".
+    // But GB18030 decodes it to U+E5E5, which is correct in theory but not in practice.
+    // To work around, just change all occurences of U+E5E5 to U+3000 (ideographic space).
+    if (_encoding == kCFStringEncodingGB_18030_2000) {
+        result.replace(0xE5E5, 0x3000);
+    }
+    
     return result;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list