Hmm. I'm not sure the author of that code did either :) In addition
to control characters and whitespace, it looks like semicolons and
quotes might also cause problems (looks like Cookie.BaseCookie can
interpret quotes and backslash escapes, but won't generate them).
Personally I always use tornado's secure cookies, which base64-encode
their payload.
-Ben