Two localized article links can look the same while containing different Unicode code points and different UTF-8 percent escapes. That is not necessarily mojibake. Both strings may be correctly encoded, but the publishing stack can still treat them as different route keys.
Decide which forms should represent one approved resource before applying normalization. The goal is not to erase accents or make every foreign-language URL look simpler. It is to maintain a deliberate relationship between the visible name, the stored identifier, generated links and the actual public route.
The case and slash contract establishes the broader rule: preserve resource meaning. This guide supplies the Unicode-equivalence fixture that a visually inspected URL list cannot provide.
Separate canonical equivalence from compatibility
Unicode Standard Annex 15 defines canonical and compatibility equivalence and the normalization forms. NFC composes canonically equivalent sequences where possible; NFD decomposes them. Compatibility forms can make additional changes and must not be substituted casually when identifiers carry meaning.
For example, an accented character can be represented as one code point or as a base character followed by a combining mark. MDN’s normalize reference demonstrates that strings can compare unequal before normalization and equal afterward. That string operation does not automatically authorize redirecting every path in a website.
Keep the distinction from incorrect byte decoding. In this exercise the characters were decoded correctly. The uncertainty is whether the application has intentionally assigned both sequences to the same resource. A screenshot cannot establish that identity decision.
State the resource map independently
Imagine a fictional French setup library. Two canonically equivalent spellings of café are approved aliases for guide-17. The unaccented word cafe is a deliberately different resource, guide-18. These are application rules for the example, not a Unicode rule saying accents always distinguish resources.
| Input form | Visible label | UTF-8 percent-encoded path | Approved identity |
|---|---|---|---|
| Composed accented form | café | /guides/caf%C3%A9 | guide-17 |
| Decomposed accented form | café | /guides/cafe%CC%81 | guide-17 |
| Unaccented form | cafe | /guides/cafe | guide-18 |
The fixture permits NFC equivalence for the first two rows but forbids collapsing the third. Do not derive the expected resource identity from the normalized string under test. The owner must supply the approved identity map independently, including legacy collisions and exceptions.
If two existing resources normalize to the same string, stop the migration. Choosing the first or last record would silently discard a resource decision. Resolve the collision editorially and technically before generating a public redirect or overwriting a CMS key.
Run a local collision and preservation test
This complete Python example uses only the standard library. It does not fetch URLs or change a server. The Unicode escape literals deliberately make the two code-point sequences inspectable in source.
import unicodedata
from urllib.parse import quote
rows = [
('guide-17', '/guides/caf\u00e9'),
('guide-17', '/guides/cafe\u0301'),
('guide-18', '/guides/cafe'),
]
def approved_map(records):
grouped = {}
for identity, path in records:
normalized = unicodedata.normalize('NFC', path)
if normalized in grouped and grouped[normalized] != identity:
raise ValueError('Normalization collides across resource identities')
grouped[normalized] = identity
return grouped
first, second, plain = [path for _, path in rows]
assert first != second
assert quote(first, safe='/') == '/guides/caf%C3%A9'
assert quote(second, safe='/') == '/guides/cafe%CC%81'
assert unicodedata.normalize('NFC', first) == unicodedata.normalize('NFC', second)
assert unicodedata.normalize('NFC', plain) != unicodedata.normalize('NFC', first)
assert len(approved_map(rows)) == 2
try:
approved_map(rows + [('guide-99', second)])
except ValueError:
print('cross-resource collision negative detected')
else:
raise AssertionError('Conflicting resource identities were merged')
print('two approved resource identities PASS')The expected output detects a cross-resource collision and preserves two approved identities. The percent-encoded strings are calculated from the actual input sequences, not copied from the browser’s potentially prettified address display.
The example normalizes a whole synthetic path because its contract contains only those plain slug segments. It is not a production recipe for decoding and normalizing arbitrary URL strings. Real paths can contain reserved delimiters, opaque IDs or signed material whose transformation is outside this contract.
Check every publishing boundary that owns the name
Record the editor input, CMS key, generated pathname, percent-encoded request target, router interpretation and final resource identity. Identify where normalization is currently performed. A database import can normalize names while a filesystem export preserves the original sequence, creating a defect that appears only after deployment.
Keep literal and percent-encoded evidence separately. Do not decode repeatedly until two strings happen to match. Use the route owner’s documented parsing stages and preserve unsupported encoded delimiters through the normal validation path. The parameter and cache identity review covers a related boundary without treating query values as interchangeable path slugs.
Update generated internal links and sitemap references only after the preferred resource map is approved. Check ordinary requests for both approved aliases and the intentionally distinct resource. A redirect reaching the right visible heading is insufficient if a different language edition or download is substituted underneath it.
Accept a narrow equivalence policy
Keep the collision negative in the release fixture and test representative composed and decomposed links through the ordinary public path. Record any canonical declarations independently from Unicode normalization: a canonically equivalent Unicode string is not the same concept as a search engine’s selected canonical URL.
Close when approved aliases reach the intended resource, distinct identities remain distinct and the publisher emits the chosen link form consistently. This establishes route integrity for the tested names. It does not promise that all visually similar strings are equivalent or that search engines will consolidate them on a fixed schedule.
