Guide Developer Tools 6 min read

Uppercasing changes the length of 103 characters, and the same call disagrees between Node and Python

Unicode's own case tables turn some characters into longer strings when uppercased, and some never come back to what they were. Node and Python follow different editions of those tables, so the same uppercase call can give different answers.

Maya Lin
Digital Platforms Analyst
Published 17 Nov 2026, 7:35 AM (SGT)
Share:
Scattered wooden capital letters on a black surface, with four arranged to spell WHEN. Scattered wooden capital letters on a black surface, with four arranged to spell WHEN. Photo by Ann Hannes on Pexels
Advertisement

Case mapping tells software the capital and small form of each character, and Unicode publishes it as plain data files. We recounted those files for Unicode 18.0.0. Of the 1,601 characters that change when uppercased, 103 uppercase to a different number of code points: ß becomes SS. Uppercase a character and lowercase it again, and 130 of the 1,601 fail to come back as they were; the 103 are among them. Across all 1,112,064 Unicode scalar values, Node 26.13 (ICU 79.1) matched the 18.0.0 files exactly. Python 3.12.15 matched Unicode 15.0 exactly, and its str.upper() disagreed with Node's toUpperCase() on 76 code points.

Sharp s leads the characters that ride up as longer strings

The full mapping is UnicodeData.txt plus the unconditional entries of SpecialCasing.txt, whose 18.0.0 header is dated 2026-05-19. Its comment on ß reads "The customary uppercase mapping is to SS, rather than to the newer U+1E9E capital sharp s."

Of the 103, 87 uppercase to two code points and 16 to three; ʼn becomes ʼN and the Armenian ligature և becomes ԵՒ. The 103rd is new in 18.0.0: U+1DF95, LATIN SMALL LIGATURE LONG S WITH DESCENDER S, which uppercases to SS. It already took two UTF-16 units, so a UTF-16 count finds 102, the same as Unicode 15.0. Lowercasing changes the length of one character, İ (U+0130), which becomes i plus U+0307 COMBINING DOT ABOVE.

Micro sign, dotless i and long s come back down to a different floor

All but one of the 130 round-trip failures sit in Unicode's Ll and Lt categories. The exception is a combining mark, U+0345 COMBINING GREEK YPOGEGRAMMENI, which goes to Ι and returns as ι. Besides the 103 length changers, 27 return at the same length as a different character. The micro sign µ goes to Greek Μ and returns as Greek μ. Dotless ı returns as i, long ſ as s, final ς as σ.

Lowercasing first and then uppercasing fails for 37 of the 1,508 characters that change when lowercased. The Kelvin sign K (U+212A) lowercases to k, which uppercases to an ordinary K, and capital ẞ lowercases to ß and then uppercases to SS. The ECMAScript 2027 draft, in a note to §22.1.3.28, gives its own reason: "Because both toUpperCase and toLowerCase have context-sensitive behaviour, the methods are not symmetrical."

Turkish, Azerbaijani and Lithuanian get their own lift buttons in the casing file

SpecialCasing.txt has language-sensitive entries for those three languages only, plus one context rule, Final_Sigma. ECMAScript's plain toLowerCase must follow "the locale-insensitive case mappings in the Unicode Character Database", so it applies none of the three.

In Node 26.13, toLocaleUpperCase('tr') departs from the default on one character, sending i to İ, and Azerbaijani matches it. Turkish lowercasing departs on two: I goes to ı and İ to i. Lithuanian lowercasing adds U+0307 to Ì, Í and Ĩ. Node's toLocaleUpperCase('el') differs from the default on 228 code points, dropping accents so that Ά becomes Α, a tailoring from ICU's CLDR data that SpecialCasing.txt does not contain.

The Java SE 21 String page says the no-argument toLowerCase() uses "the rules of the default locale" and may surprise on "programming language identifiers, protocol keys, and HTML tags". Its example: "TITLE".toLowerCase() in a Turkish locale returns "t\u0131tle", an escape that prints as tıtle, with a dotless ı. That result appears only when the JVM's default locale is Turkish.

Version lag puts Python a few floors below Node on the same call

Node 26.13 reports Unicode 18.0 and had no mismatches against the 18.0.0 files. Python 3.12.15 ships Unicode 15.0.0 and had none against the 15.0.0 files. Against 18.0.0 its upper() differed on 76 code points. Its lower() differed on 75, and casefold() on 76. Neither is wrong; they carry two editions of one table.

Advertisement

Most of the gap is characters added after 15.0, but eight already existed, each its own uppercase until a capital was encoded for it: U+019B ƛ and U+0264 gained one in 16.0, U+A7D3 and U+A7D5 in 17.0, and U+0277, U+027C, U+AB4B and U+AB4C in 18.0. The Unicode stability policy allows this: a character outside a case pair "could become part of one if the new case pair is formed at the time of the addition of a new character". So uppercasing an existing string can give a new answer after an upgrade. Between 15.0 and 18.0, no lowercase change touched a character that already existed.

Python lets file and file share one name

The Python 3.12 language reference says "All identifiers are converted into the normal form NFKC while parsing; comparison of identifiers is based on NFKC." On 3.12.15, exec('file = 1') bound a variable named file, and exec('dž=2') bound the two code points dž.

Lowercasing is a weaker comparison than folding. In Node, "STRASSE".toLowerCase() === "straße".toLowerCase() is false. In Python, "STRASSE".casefold() == "straße".casefold() is True, and the 3.12 built-in types page uses that very conversion, ß to ss, as its example of folding.

ASCII-only word splitting misses the landing for almost every other capital

For word splitting we took every clean case pair in Unicode 18.0.0, a capital whose lowercase is one character that uppercases back to it: 1,471 pairs, 323 outside the Basic Multilingual Plane. Until 16 November 2026 our code case converter found a camelCase boundary before only 26 of those capitals, A to Z, so résuméParser became résuméparser and the Vietnamese giáĐơn became giáđơn. Reading only the first UTF-16 unit, it capitalised no word that began with one of the 323.

The revision dated 16 November 2026 reads boundaries from Unicode's character properties and finds all 1,471. It capitalises all 323 with the titlecase form, which differs from uppercase for 136 characters. It also re-splits every output and marks any form that will not convert back. Type straße_name and CONSTANT_CASE gives STRASSE_NAME, marked. Type µs_delay and PascalCase opens with Greek capital Μ, with a note tracing µ to Μ to μ.

The losses remain. On our probe of 1,570 characters that are their own lowercase and change when uppercased, a snake_case to CONSTANT_CASE to snake_case trip returned different text for 75, a separate test with its own denominator. The revised converter marks all 75 rows; it cannot bring them back.

Case folding over NFKC is the floor that stays put across versions

The stability policy promises that case pairs, once formed, stay formed, and that "Caseless matching of Unicode strings used for identifiers is stable", stated for toCasefold(toNFKC(S)) over strings drawn from a single given version. The policy warns that this and toNFKC_Casefold(S) are distinct. Our sweep fits the promise: no folding changed between 15.0 and 18.0 for any character 15.0 already had.

Databases add their own choice. The PostgreSQL 18 manual says "The folding of unquoted names to lower case in PostgreSQL is incompatible with the SQL standard, which says that unquoted names should be folded to upper case."

We ran the counts on 16 November 2026 over the 15.0.0 to 18.0.0 data files, one code point at a time, so they describe single characters rather than real identifiers. The Unicode data files are Copyright © 1991-2026 Unicode, Inc., used under the Unicode License V3.

Advertisement
Maya Lin
Digital Platforms Analyst

Maya Lin covers SaaS platforms, workflow automation, creator tools, and productivity software for RECATOOLS.

View author profile → · Editorial policy

About this byline Maya Lin is a RECATOOLS editorial persona used for platform and productivity coverage. Articles are produced and reviewed under RECATOOLS editorial supervision.

Corrections policy

Advertisement