Document.cookie returns empty string if any cookie in the domain has non-ASCII characters

3,314 views
Skip to first unread message

Tim Lenz

unread,
Aug 25, 2014, 3:49:24 PM8/25/14
to chromium...@chromium.org
A single cookie in my domain will occasionally store a non-ASCII value, such as an accented 'á'. I know this isn't ideal, but Chrome (36.0.1985.143 m, Windows 7) won't return ANY cookie from the domain even if only one cookie is problematic. A javascript call to document.cookie in the console returns the empty string "", whereas in Firefox and other browsers, it will at least return the list of cookies, with non-ASCII characters appearing as a question mark '?'. I expect people will tell me to encode or not use non-ASCII characters in cookies but to fix this is more of a long-term project so it would be nice if Chrome behaved the same way as Firefox in this instance. 

PhistucK

unread,
Aug 25, 2014, 4:39:44 PM8/25/14
to tcl...@gmail.com, Chromium-discuss
When I set a cookie with that character (in the console), document.cookie returns the cookies as usual.
document.cookie = "p=á;" + document.cookie;
document.cookie // Returns all of the cookies, including the one I just set.
Does that work for you?
If so, are you setting the cookie server side?


PhistucK


On Mon, Aug 25, 2014 at 10:49 PM, Tim Lenz <tcl...@gmail.com> wrote:
A single cookie in my domain will occasionally store a non-ASCII value, such as an accented 'á'. I know this isn't ideal, but Chrome (36.0.1985.143 m, Windows 7) won't return ANY cookie from the domain even if only one cookie is problematic. A javascript call to document.cookie in the console returns the empty string "", whereas in Firefox and other browsers, it will at least return the list of cookies, with non-ASCII characters appearing as a question mark '?'. I expect people will tell me to encode or not use non-ASCII characters in cookies but to fix this is more of a long-term project so it would be nice if Chrome behaved the same way as Firefox in this instance. 

--
--
Chromium Discussion mailing list: chromium...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discu...@chromium.org.

Reply all
Reply to author
Forward
0 new messages