Why identical-looking Unicode filenames produce different Base64
Compare composed and decomposed forms of é and the Korean syllable 가. The rendered names can match even though the UTF-8 bytes differ.
Isolate the filename as text
This experiment encodes the filename string, independently of any file contents. A Korean syllable can be stored as U+AC00 or as the pair U+1100 U+1161. A font can draw both sequences as 가, hiding the difference during a visual comparison.
Compare the four byte sequences
The composed Korean sample takes three UTF-8 bytes. Its decomposed equivalent takes six. The letter é likewise has a single-code-point form and an e followed by a combining accent. Decode the rows as UTF-8 to see how little the display reveals about byte length.
| Input | Bytes in hexadecimal | Base64 |
|---|---|---|
é · NFC | C3 A9 | w6k= |
é · NFD | 65 CC 81 | ZcyB |
가 · NFC | EA B0 80 | 6rCA |
가 · NFD | E1 84 80 E1 85 A1 | 4YSA4YWh |
Choose a comparison rule
For a name lookup, normalize both candidate strings with JavaScript name.normalize("NFC") before comparing. For a byte-for-byte round trip or a digest of the original name, keep the exact source value. Applying normalization silently changes what will be encoded next.