Open lionel-rowe opened 1 month ago
As far as I can see, the problematic uses are toLocaleLowerCase
and toLocaleUpperCase
in http/cookie.ts
, http/_negotiation/encoding.ts
, and in the various casing functions under text
. By contrast, fmt/bytes.ts
is a best practice for allowing opt-in locale sniffing:
https://github.com/denoland/std/blob/6a4eb6cb9185b0b9e0816a227c04b5bf039b99ef/fmt/bytes.ts#L193-L195
and testing it with minimal hard-coding:
Describe the bug
I've mentioned this before tangentially in a couple of issues (ex), but it's probably worth its own issue.
Use of locale-sensitive methods, such as
toLocaleLowerCase
, with an unspecified (undefined
) locale may cause environment-sensitive bugs, because the default locale is host defined.Steps to Reproduce
For example, in
http/cookie.ts
, which is marked browser-compatible:https://github.com/denoland/std/blob/6a4eb6cb9185b0b9e0816a227c04b5bf039b99ef/http/cookie.ts#L361
Go to https://codepen.io/lionel-rowe/pen/rNEXmoG?editors=0010:
about:preferences
Expected behavior
Consistent behavior in all locales
Environment
http/cookie
http/negotiation
text