Cookie encoding

Harri Porten porten at froglogic.com
Sat Oct 18 13:06:40 BST 2003


Hi,

cookie handling is not 8-bit clean as show in bug report #53011. I saw
that Waldo now nailed down the encoding to be latin1. When a cookie is set
from JavaScript utf8 is still being used by HTMLDocument::setCookie().

Okay to commit the attached patch ?

Harri.

P.S. Will try out what happens in other browser if Cookie strings contain
characters > 255.
-------------- next part --------------
Index: html_documentimpl.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/html/html_documentimpl.cpp,v
retrieving revision 1.153
diff -u -3 -p -r1.153 html_documentimpl.cpp
--- html_documentimpl.cpp	3 Oct 2003 21:21:42 -0000	1.153
+++ html_documentimpl.cpp	18 Oct 2003 11:26:11 -0000
@@ -177,10 +177,10 @@ void HTMLDocumentImpl::setCookie( const 
 
     QByteArray params;
     QDataStream stream(params, IO_WriteOnly);
-    QString fake_header("Set-Cookie: ");
-    fake_header.append(value.string());
+    QCString fake_header("Set-Cookie: ");
+    fake_header.append(value.string().latin1());
     fake_header.append("\n");
-    stream << URL() << fake_header.utf8() << windowId;
+    stream << URL() << fake_header << windowId;
     if (!kapp->dcopClient()->send("kcookiejar", "kcookiejar",
                                   "addCookies(QString,QCString,long int)", params))
     {


More information about the kfm-devel mailing list