A homograph is a pair of different characters that appear visually identical. The underlying code points can differ, so ordinary string equality, validation, and uniqueness checks may treat them as distinct. section 2.1.2
Normalization addresses equivalent code-unit sequences, not every visual impersonation. Normalize at system boundaries and before validation; use NFKC for security-critical comparisons, then add explicit homograph detection. section 2.1.2
Practical safeguards include:
- Normalize usernames before comparing or storing them, so canonically equivalent spellings do not create duplicate identities. section 2.1.2
- Restrict critical identifiers such as usernames to ASCII when visual impersonation carries significant risk. section 2.1.2
- Treat Unicode-aware matching separately: JavaScript regular expressions need the u flag to process complete Unicode characters rather than UTF-16 code units. section 2.1.2
Latin and Cyrillic lookalikes
const latin = 'a'; const cyrillic = 'а'; These characters look alike but represent different code points, so a visual comparison can mislead while strict equality distinguishes them. section 2.1.2
