Skip to content

Update unicode - #3

Merged
toots merged 1 commit into
mainfrom
update-unicode
Aug 9, 2026
Merged

toots merged 1 commit into
mainfrom
update-unicode

Conversation

@toots

@toots toots commented Mar 22, 2023 •

Copy link
Copy Markdown
Member

Update Unicode data to 17.0.0

Camomile's Unicode Character Database was still at 3.2, dated 2002, so everything added to Unicode since then was missing: scripts, code points, case mappings, collation weights.

Beyond the data refresh, the parts of the library that had the Unicode data baked into their source are now generated from the data itself, so future updates are a data change and nothing else. UCharInfo.script_type and UCharInfo.version_type are produced by a new src/tools/gen_unidata.ml from Scripts.txt and DerivedAge.txt. The old hand-written version_type also encoded versions as Char.chr (major * 16 + minor), which overflows at Unicode 16; versions are now a sequential byte, still ordered so that UCharInfo.older stays a plain comparison. Note that `v1_0 is gone, since the UCD only tracks ages from 1.1 onwards.

Refreshing the data is a dune alias:

CAMOMILE_UPDATE_UNICODE=1 dune build @update-unicode --auto-promote

It downloads the latest published release and rewrites the vendored files in place; without --auto-promote it only reports what is out of date. The variable is what gates the download. It is needed because dune build builds every declared target in the tree, and the vendored data must stay buildable offline — with the variable unset the alias does nothing and says so rather than passing silently.

Two parser fixes were required for the modern formats: parse_allkeys for the three-weight collation element syntax and the @implicitweights directives, and parse_scripts for regexps that were matching a literal backslash instead of a tab.

One library bug surfaced: canonical composition ignored the blocking rule of UAX #15 D115 and composed across an intervening character of higher combining class, so NFC("େ̴ା") wrongly yielded ୋ̴. Fixed in uNF.ml.

Tests

The conformance data moves to upstream's _SHORT variants, which carry the same 208k and 230k test lines without the comment column, cutting test/unidata from 41M to 5M. NormalizationTest.txt now passes in full, 506,668 cases, which it did not before the composition fix.

The UCA collation conformance suites and the Thai word list are excluded from dune runtest and run under dune build @uca-conformance, where 702 of ~456k assertions fail. Both causes are pre-existing and only became visible because the modern test file is 25 times larger. uCol.ml strips completely ignorable characters before matching contractions, which defeats the blocking rule of UAX #10 S2.1.1-S2.1.3 — 0B47 1D165 0B3E contracts to 0B4B when it should not. Keeping those characters costs about as many failures elsewhere, so the fix is a rework of uCol rather than a patch, and is left for separate work. Separately, the Thai tailoring in src/locales/th.txt dates from 2001 and conflicts with the prevowel handling DUCET now does natively. This is documented in test/tester/test_uCol.ml.

Everything else is green.

@toots toots changed the title first stab. Update unicode Mar 22, 2023
@toots
toots marked this pull request as ready for review August 2, 2026 17:58
@toots

toots commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

This is a relatively straight forward lift of the existing mechanisms already in place and in need of TLC for a while. Will merge soon and prepare a release unless there is an objection.

@toots
toots merged commit 7729c55 into main Aug 9, 2026
4 checks passed
@toots
toots deleted the update-unicode branch August 9, 2026 14:51
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.

1 participant