Re: UTF-8 in Cookie Names

On Thu, Jul 23, 2026 at 08:51:42AM -0700, Xyan Bhatnagar wrote:
> Why do browsers accept raw UTF-8 characters in cookie-names? Is this a
> cinsequence of practically seeing UTF-8 code points being used for
> cookies?

Probably because they split on `;` and then on `=` as one would expect
and w/o actually validating that any of the resulting tokens are
US-ASCII.

> Because there is a lack of standardization around how raw UTF-8 is
> handled in cookie names, I sense possible problems here. For example,
> servers and UAs may parse cookie names as UTF-8 and strip out NEL/NBSP
> as whitespace, which can (problematically) change a cookie name from
> “<NBSP>__Host-test” to “__Host-test”.

Servers won't choose cookie names that user-agents can't use with the
same name.  I.e., the server's need to limit itself to cookie names that
will work makes interoperability rather self-enforcing in this case.

I'm not sure there's really any problem here other than to maybe
acknowledge the common use of UTF-8 in cookie names (and, presumably,
values).  There is probably no need to say anything about normalization,
either, just that the user-agent SHOULD preserve the form of the cookie
name and value if it accepts UTF-8, and probably that it MAY (SHOULD?)
accept UTF-8.

But this is really not an I18N issue given that cookie names are not a
UI element.

Nico
-- 

Received on Monday, 27 July 2026 22:26:05 UTC