Summary: | xmlhttprequest breaks on utf-8 strings | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Rob Kaper <webmaster> |
Component: | kjs | Assignee: | Konqueror Developers <konq-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | Patch (fixes test case for me) |
Description
Rob Kaper
2006-07-23 16:24:01 UTC
Version: 3.5.3 (using KDE 3.5.3) Compiler: gcc (GCC) 3.4.5 (Gentoo 3.4.5, ssp-3.4.5-1.0, pie-8.7.9) OS: Linux i686 2.6.17-ck1-r2 #1 PREEMPT Same problem here with german "Umlaute". Seems to me as there runs something wrong when konqueror calculates the string length of the utf-8 encoded string. Same problem occures in Safari-2.0.4 if in the request the content-type header is set to something different from "text/javascript". Duplicate bug #119391 Created attachment 17476 [details]
Patch (fixes test case for me)
Attached patch fixes the issue for me
Patch fixes issue for me too. SVN commit 576640 by ggarand: apply patch by James Thorniley<james_thorniley@yahoo.co.uk> for "xmlhttprequest breaks on utf-8 strings" BUG:131242 M +1 -1 xmlhttprequest.cpp --- branches/KDE/3.5/kdelibs/khtml/ecma/xmlhttprequest.cpp #576639:576640 @@ -335,7 +335,7 @@ // FIXME: determine post encoding correctly by looking in headers // for charset. QByteArray buf; - buf.duplicate(_body.utf8().data(), _body.length()); + buf.duplicate(_body.utf8().data(), _body.utf8().length()); job = KIO::http_post( url, buf, false ); if(contentType.isNull()) SVN commit 576656 by dfaure: Calling utf8() twice is expensive, calling length() on a QCString is expensive, so better not do either one :) CCBUG: 131242 M +2 -1 xmlhttprequest.cpp --- branches/KDE/3.5/kdelibs/khtml/ecma/xmlhttprequest.cpp #576655:576656 @@ -335,7 +335,8 @@ // FIXME: determine post encoding correctly by looking in headers // for charset. QByteArray buf; - buf.duplicate(_body.utf8().data(), _body.utf8().length()); + QCString str = _body.utf8(); + buf.duplicate(str.data(), str.size() - 1); job = KIO::http_post( url, buf, false ); if(contentType.isNull()) |