[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
robert at webkit.org
robert at webkit.org
Wed Dec 22 13:46:18 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 180c8e77b084c9b270fbfc149cf4f129e55dd382
Author: robert at webkit.org <robert at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sun Sep 26 13:12:10 2010 +0000
2010-09-26 Robert Hogan <robert at webkit.org>
Reviewed by Andreas Kling.
[Qt] fix http/tests/uri/escaped-entity.html
Replace invalid encodings with the appropriate escaped entity.
See also http://bugreports.qt.nokia.com/browse/QTBUG-13412
https://bugs.webkit.org/show_bug.cgi?id=45245
* platform/qt/Skipped:
2010-09-26 Robert Hogan <robert at webkit.org>
Reviewed by Andreas Kling.
[Qt] fix http/tests/uri/escaped-entity.html
Replace invalid encodings with the appropriate escaped entity.
See also http://bugreports.qt.nokia.com/browse/QTBUG-13412
https://bugs.webkit.org/show_bug.cgi?id=45245
* platform/text/qt/TextCodecQt.cpp:
(WebCore::TextCodecQt::encode):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68341 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 40d7ac7..e6a84c4 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-09-26 Robert Hogan <robert at webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] fix http/tests/uri/escaped-entity.html
+
+ Replace invalid encodings with the appropriate escaped entity.
+
+ See also http://bugreports.qt.nokia.com/browse/QTBUG-13412
+
+ https://bugs.webkit.org/show_bug.cgi?id=45245
+
+ * platform/qt/Skipped:
+
2010-09-25 Abhishek Arya <inferno at chromium.org>
Reviewed by Nikolas Zimmermann.
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index 027e3c1..7aa7960 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -178,9 +178,6 @@ http/tests/security/originHeader/origin-header-for-empty.html
http/tests/media
http/tests/wml
-# not utf8-encoding urls as expected
-http/tests/uri/escaped-entity.html
-
# https://bugs.webkit.org/show_bug.cgi?id=44282
http/tests/incremental/slow-utf8-text.pl
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 878ddf2..b60f7c3 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-09-26 Robert Hogan <robert at webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] fix http/tests/uri/escaped-entity.html
+
+ Replace invalid encodings with the appropriate escaped entity.
+
+ See also http://bugreports.qt.nokia.com/browse/QTBUG-13412
+
+ https://bugs.webkit.org/show_bug.cgi?id=45245
+
+ * platform/text/qt/TextCodecQt.cpp:
+ (WebCore::TextCodecQt::encode):
+
2010-09-25 Abhishek Arya <inferno at chromium.org>
Reviewed by Nikolas Zimmermann.
diff --git a/WebCore/platform/text/qt/TextCodecQt.cpp b/WebCore/platform/text/qt/TextCodecQt.cpp
index 94a2b7b..1e95d87 100644
--- a/WebCore/platform/text/qt/TextCodecQt.cpp
+++ b/WebCore/platform/text/qt/TextCodecQt.cpp
@@ -29,7 +29,6 @@
#include "PlatformString.h"
#include <wtf/text/CString.h>
#include <qset.h>
-// #include <QDebug>
namespace WebCore {
@@ -125,14 +124,41 @@ String TextCodecQt::decode(const char* bytes, size_t length, bool flush, bool /*
return unicode;
}
-CString TextCodecQt::encode(const UChar* characters, size_t length, UnencodableHandling)
+CString TextCodecQt::encode(const UChar* characters, size_t length, UnencodableHandling handling)
{
+ QTextCodec::ConverterState state;
+ state.flags = QTextCodec::ConversionFlags(QTextCodec::ConvertInvalidToNull | QTextCodec::IgnoreHeader);
+
if (!length)
return "";
- // FIXME: do something sensible with UnencodableHandling
+ QByteArray ba = m_codec->fromUnicode(reinterpret_cast<const QChar*>(characters), length, &state);
+
+ // If some <b> characters </b> are unencodable, escape them as specified by <b> handling </b>
+ // We append one valid encoded chunk to a QByteArray at a time. When we encounter an unencodable chunk we
+ // escape it with getUnencodableReplacement, append it, then move to the next chunk.
+ if (state.invalidChars) {
+ state.invalidChars = 0;
+ state.remainingChars = 0;
+ int len = 0;
+ ba.clear();
+ for (size_t pos = 0; pos < length; ++pos) {
+ QByteArray tba = m_codec->fromUnicode(reinterpret_cast<const QChar*>(characters), ++len, &state);
+ if (state.remainingChars)
+ continue;
+ if (state.invalidChars) {
+ UnencodableReplacementArray replacement;
+ getUnencodableReplacement(characters[0], handling, replacement);
+ tba.replace('\0', replacement);
+ state.invalidChars = 0;
+ }
+ ba.append(tba);
+ characters += len;
+ len = 0;
+ state.remainingChars = 0;
+ }
+ }
- QByteArray ba = m_codec->fromUnicode(reinterpret_cast<const QChar*>(characters), length, 0);
return CString(ba.constData(), ba.length());
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list