Re: String encoding in cookies make them be rejected by PHP
> Well, I managed to work around this problem by changing the PHP, so
> that it converts the cookie to what it needs to see.
> But, I still want to know how to control cookie encoding in CherryPy.
> Can someone point me to a doc? It's not easily found through a web
I found the source code for Cookie.py illuminating:
# These quoting routines conform to the RFC2109 specification, which in
# turn references the character definitions from RFC2068. They provide
# a two-way quoting algorithm. Any non-text character is translated
# into a 4 character sequence: a forward-slash followed by the
# three-digit octal equivalent of the character. Any '\' or '"' is
# quoted with a preceeding '\' slash.
# These are taken from RFC2068 and RFC2109.
# _LegalChars is the list of chars which don't require "'s
# _Translator hash-table for fast quoting
_LegalChars = string.ascii_letters + string.digits +
...so it seems you could extend the set of legal characters (and
thereby avoid quoting) if you really needed to. But from a cursory
glance, it looks like the Cookie module gets it right (according to the
spec), and you should look at PHP's cookie-handling to see if it even
mentions quoting concerns.