UTF-8 in Cookie Names

Hi all,

The RFC6265 grammar (4.1.1) says that a cookie name must be comprised of the set of US-ASCII characters without control characters and separators.

Yet, all major browsers seem to accept non-ASCII characters in cookie names. These include UTF-8 code points like emojis and international characters.

RFC626 also says under section 5.6 “The Set-Cookie Header Field" that “the algorithm is more permissive than the grammar”, but even that loosens the restrictions to cookie-octets (still US-ASCII) or octet sequences that are percent-encoded (not raw UTF-8).

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?

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”.

Regards,
Xyan

Received on Thursday, 23 July 2026 15:51:57 UTC