Skip to content

Replace String.lowercase_ascii with Uucp.Case.Fold for i18n-aware comparison - #3739

Open
JoeJoeflyn wants to merge 1 commit into
ocaml:mainfrom
JoeJoeflyn:fix/uucp-caseless-comparison-2444
Open

Replace String.lowercase_ascii with Uucp.Case.Fold for i18n-aware comparison#3739
JoeJoeflyn wants to merge 1 commit into
ocaml:mainfrom
JoeJoeflyn:fix/uucp-caseless-comparison-2444

Conversation

@JoeJoeflyn

@JoeJoeflyn JoeJoeflyn commented Aug 11, 2026

Copy link
Copy Markdown

Summary

  • Replace String.lowercase_ascii with Unicode case folding (Uucp.Case.Fold) for case-insensitive string comparison
  • Define case_fold once in src/global/import.ml, reuse everywhere via Ocamlorg.Import.String.case_fold
  • Update is_sub_ignore_case to use case_fold instead of lowercase_ascii
  • Swap 7 call sites: academic institution search, package search, opam user search, platform release tag matching
  • Leave 3 ASCII-only sites unchanged (env var parsing, slugify, cookbook example)

This fixes case-insensitive matching for non-ASCII text (e.g. searching école now matches ÉCOLE, which String.lowercase_ascii could not handle since it only lowercases A-Z).

uucp was already a transitive dependency — this makes it a direct dependency of ocamlorg.global.

Checklist

Test plan

  • make build passes
  • make test passes (21 tests, all OK)
  • Verified case_fold "école" = case_fold "ÉCOLE" (was false with lowercase_ascii, now true)

…parison

Use Unicode case folding instead of ASCII-only lowercase for
case-insensitive string comparison across the codebase. This fixes
search/matching for non-ASCII names (e.g. José, Müller, École).

case_fold is defined once in src/global/import.ml and reused
everywhere via Ocamlorg.Import.String.case_fold.

Resolves ocaml#2444
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use uucp caselesseq instead of structural equality and String.ascii_lowercase

1 participant