Skip to content

#1235: Match Excel Thai text ordering - #1241

Open
justinjohn0306 wants to merge 1 commit into
storytold:mainfrom
justinjohn0306:codex/issue-1235-thai-sort
Open

justinjohn0306 wants to merge 1 commit into
storytold:mainfrom
justinjohn0306:codex/issue-1235-thai-sort

Conversation

@justinjohn0306

Copy link
Copy Markdown
Contributor

Fixes #1235.

Thai leading vowels (เ แ โ ใ ไ) now sort before Thai consonants in the shared text comparator. This brings SORT and formula string comparisons such as ="เกม"<"กา" in line with Excel's reported ordering while keeping one consistent total order for mixed scripts.

Regression tests cover the issue's Thai SORT sample, the comparison operator, and mixed Latin/Thai ordering.

Verified with cargo xtask ci (fmt, clippy, workspace tests, assets, layers, WASM, and parity all pass).

marcoarnulfo added a commit to marcoarnulfo/gridcraft that referenced this pull request Oct 22, 2026
…reak ties, ß/æ/œ tie with ss/ae/oe, Thai leading vowels first

Thai tone marks, Hebrew points, Arabic harakat and the Indic nukta/anusvara are not alphabetic, so the
first sort level counted them as punctuation and put ข้าว before ขาว. They are now ignored at the first
level (DUCET's primary-ignorable Mn characters of those scripts); viramas count as letters. ß, æ, œ
and ij equal their two letters at every level, so descending sorts keep `ss, ß` in input order as Excel
does. A word starting with a Thai leading vowel sorts before the Thai consonants (Excel, storytold#1235), the
rule storytold#1241 adds to compare_text, which SORT no longer uses for two texts.

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReviewerA — source-read COMMENT (not an approval)

I read the head of the diff: Thai text ordering matches Excel (#1235). The case-insensitive text order in the core is extended so that Thai leading vowels are ordered by the consonant that follows them, with a test that "เกม" < "กา" is TRUE. Excel's comparison uses the operating system's locale collation, which for Thai ignores the leading vowel at the first level, so the idea is right; whether each expected value in the test is what Excel gives is something I cannot check, and the contributor should show Excel's result for each assertion. A locale-specific special case inside the value comparison is also the third approach to collation in the suite (gridcraft#2036, #2409 and deckcraft#1052 use ICU4X or UCD data), and they should be reconciled. I have not run it, and no exact-head CI result exists for this head. Nothing was run.

I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.

Status: waiting_author.

This branch has not been deployed

No deployments
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.

SORT and string comparison put Thai leading vowels after all consonants

2 participants