Skip to content

fix: make camelToUpperSnake Unicode-safe for acronym boundaries #4

Description

@masonkatz

camelToUpperSnake iterates over runes but looks ahead with s[i+1], where i is a byte index. The lookahead therefore inspects a UTF-8 continuation byte for non-ASCII input and misses the uppercase-acronym-to-lowercase boundary it is intended to recognize.

Acceptance criteria

  1. Add a regression test for a non-ASCII uppercase acronym followed by a lowercase word, such as a Greek or Cyrillic equivalent of URLValue.
  2. Confirm the expected output includes the underscore word boundary.
  3. Replace byte-based lookahead with rune-safe lookahead while preserving existing ASCII and Unicode test cases.
  4. Run the relevant test suite.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions