Identical-Looking Terms That Won't Match: A Unicode Issue

The term is clearly listed in the glossary, yet the program reports no match. Printing out the string reveals that both sides appear identical. The issue may no

If you maintain a glossary or term base for translation, you may have seen a term that is clearly listed but never matches. The string prints the same on screen, yet the program reports no match. This guide is for developers and localisation teams who need to track down that kind of failure.

The cause is usually not the translation itself but how Unicode represents characters. An accented letter such as é can be stored as a single code point, or as a base letter followed by a combining diacritical mark. Both forms look identical, but they are different strings to a program.

You will learn how to tell a representation difference from a content discrepancy, how to normalise text for matching while keeping the original, and where normalisation stops helping.

This guide uses synthetic samples to demonstrate the processing method. Before processing important files, keep the original copies and verify the results against the boundaries and acceptance criteria in your own documentation.

Why won't identical-looking terms match? The short answer

The two terms usually differ at the code-point level, so normalise both with NFC before comparing them, and keep the original text for display and review.

Your situationWhat to doWhy
Accented letters look the same but don't matchCompare after NFC normalisationNFC aligns representations that are normatively equivalent
Full-width or superscript characters differAssess NFKC against your business needsNFKC collapses compatibility characters, which may suit search but not archival work
Matching fails because of capitalisationUse a case-insensitive key with casefoldcasefold makes matching case-insensitive, though its results are language-specific
Still no match after normalisingInspect code points and contextNormalisation does not resolve every look-alike case

Step 1: Check whether it is a representation difference or a content discrepancy

Start by checking whether the two strings differ in how they are encoded.

  • NFC normalisation is applied to both strings before comparison. It is commonly used to align representations that are normatively equivalent.
  • NFKC has a broader scope. It collapses certain compatibility characters. This may suit search requirements, but it does not necessarily meet the needs of archival preservation or technical symbol comparison.
  • Do not mistake "easier matching" for "semantic invariance."

In the synthetic example, the two writing styles of é should match after NFC. Full-width letters and superscript characters illustrate the changes NFKC brings. These are specific examples, not requirements that every item adopt one particular form.

Step 2: Use code to reveal differences you couldn't see

import unicodedata as ud

composed = "café"
decomposed = "cafe\u0301"
assert composed != decomposed
assert ud.normalize("NFC", composed) == ud.normalize("NFC", decomposed)

fullwidth = "ABC"
assert ud.normalize("NFC", fullwidth) == fullwidth
assert ud.normalize("NFKC", fullwidth) == "ABC"
assert ud.normalize("NFKC", "x²") == "x2"

def term_key(text):
    return ud.normalize("NFC", text).casefold()

assert term_key("CAFÉ") == term_key(decomposed)
assert term_key("x²") != term_key("x2")
print([f"U+{ord(c):04X}" for c in decomposed])

The example uses NFC plus casefold for term matching. This is an intentionally constrained matching strategy. casefold also produces language-specific folding results, so do not replace all original text with generated keys just because it is convenient.

Step 3: Store the original text and the matching key separately

Keep two fields rather than one:

  • original_text is used for display, traceability and review.
  • normalized_key is built for retrieval under the current policy.

Record the policy name and version. If a different rule is adopted later, you can rebuild the index instead of discovering that the original text has already been overwritten irreversibly.

Step 4: Decide what to change and what to leave alone

Use this table to choose a safe next action for each observation.

ObservationActions you can attemptActions to avoid casually
Accent differencesApply NFC according to a defined policyClaiming the number of characters no longer matters
Full-width/half-width differencesAssess NFKC according to business requirementsOverwriting the original technical document directly
Case sensitivityEstablish a case-insensitive matching keyConverting all displayed text to lowercase
Still missesView code points and the actual contextRepeatedly applying replacement rules by chance

Where normalisation stops helping

Normalisation does not solve every "looks the same" problem.

  • Latin letters that look similar to one another, and characters from other scripts, do not necessarily have normative or compatibility equivalence.
  • Zero-width characters, different types of spaces, and OCR errors that mistake letters for digits each need their own diagnostics.
  • In security-sensitive contexts such as account numbers or file identifiers, do not treat the matching examples in this guide as full protection against obfuscated characters.
  • Length can change after normalisation. Trimming the original text with character offsets from the matching key may produce incorrect segments. When highlighting or writing back, keep a mapping of the original text segments, or re-locate positions at the original-text level.

Preserve the evidence before handing the issue to translation

When you work with terminology and translation workflows, prepare the two Unicode representations of the same term, and record the source text, the strategy and the target translation. OmniDoc (product entry point) can help you organise this kind of workflow. When an inconsistency appears, you can then tell whether it lies in input matching or in translation selection, rather than blaming the translation model for everything.

Reference: Python unicodedata

📊 At a glance

FormWhat it doesKeep in mind
NFCAligns representations that are normatively equivalent before comparisonUse it for matching, and keep the original text for display
NFKCAlso collapses compatibility characters such as full-width letters and superscriptsMay suit search, but not necessarily archival preservation or technical symbol comparison

🎯 Which approach fits you?

If you match glossary terms in translation

Normalise both strings with NFC, and store original_text and normalized_key separately.

If you preserve archival or technical text

Be cautious with NFKC, and never overwrite the original document directly.

If you handle identifiers in security-sensitive contexts

Treat normalisation as one check among several, not as full protection.

❓ FAQ

1. Why do two identical-looking strings fail to match?

An accented character can be stored as a single code point or as a base letter plus a combining diacritical mark. Both look the same but are different strings to a program.

2. Should I replace my original text with normalised text?

No. Keep original_text for display, traceability and review, and build a separate normalized_key for retrieval.

3. What is the difference between NFC and NFKC?

NFC aligns normatively equivalent representations. NFKC also collapses compatibility characters such as full-width letters and superscripts, which may not suit archival or technical use.

4. Does normalisation fix every look-alike problem?

No. Look-alike Latin letters, characters from other scripts, zero-width characters, different spaces and OCR errors each need their own diagnostics.

📝 Summary

Identical-looking terms often differ at the code-point level, so compare them with NFC while keeping the original text intact. Check the remaining cases separately, because normalisation does not cover every look-alike character.

Try it now: upload a document and get it translated with the layout intact

Updated 2026-11-29