Skip to content

toLower/toUpper are tricky to define #1

@drathier

Description

@drathier

String.toUpper only handles a-z. This breaks Swedish, for example. åsa gets uppercased to åSA instead of ÅSA, assuming the å character is a single code point.

Unfortunately, which lowercase characters correspond to what uppercase characters is locale-dependent, so implementing a non-ascii version is tricky. https://stackoverflow.com/questions/12537377/in-haskell-how-can-i-uppercase-a-unicode-character-with-respect-to-current-local

I'd suggest dropping these functions and using css (text-transform: uppercase) to uppercase/lowercase written strings, hoping that the browser locale is correct most of the time. For case-insensitive string comparisons, there's unicode normalization algorithms which can be used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions