Inspect text for non-ASCII characters

How a non-ASCII character check finds invisible and look-alike characters, what cleaning changes, and when plain text is the safer choice.

A non-ASCII check flags every character outside the 128-character ASCII range, code points U+0000 to U+007F. Many problem characters fall outside that range but cannot be seen: zero-width spaces, byte order marks, direction controls and non-breaking spaces. Text styled with fancy-font generators or mirror tools is also non-ASCII. This review explains what an inspection reveals, what changes when you act on the results, and how to judge whether the cleaned or transformed text still works where you plan to use it.

Is a non-ASCII inspection suitable for your use?

Recommendation: inspect any text where hidden characters can cause real failures. This includes code, configuration files, CSV imports, usernames, URLs typed into documents, search keywords, and text pasted from PDFs, chat apps or styled-text generators. The main benefit is visibility. You see exactly which code points are present, so you can explain why two strings that look identical fail to match.

The key tradeoff is that "non-ASCII" is a much wider category than "problematic." Accented letters, non-Latin scripts, curly quotes, dashes and emoji are all non-ASCII, and most of them carry meaning. A check is safe because it only reports. Removing everything it flags is not safe for most human-language text.

Restricting text to plain ASCII makes sense when the destination formally requires it. Examples include some legacy systems, certain identifiers, and protocols or file formats with an ASCII-only rule. Even then, decide case by case whether to transliterate, encode or reject a character rather than deleting it silently.

What inspection and cleanup actually change

Detection leaves the text unchanged

A pure inspection reads the stored characters and reports them. It typically shows each code point, its official Unicode name, and its general category. Nothing in the text changes. This matters because many tools that call themselves checkers also offer a one-click "clean" or "fix" button, and that is a different operation.

Removal, replacement and normalization alter stored characters

Each cleanup option changes the underlying data in a different way:

  • Stripping deletes code points. Removing a zero-width joiner from an emoji sequence splits it into separate emoji. Removing a zero-width non-joiner can change how words are written in scripts such as Persian, where that character is part of correct spelling.
  • Replacing substitutes one character for another, for example turning a non-breaking space into an ordinary space. The text looks the same, but line-breaking behavior changes.
  • Unicode normalization (NFC, NFD, NFKC, NFKD) rewrites equivalent sequences. NFC and NFD only switch between composed and decomposed forms, such as a single precomposed letter versus a base letter plus a combining accent. NFKC and NFKD also fold compatibility characters into plain forms. That can turn mathematical bold letters back into ordinary letters, but it can also change ligatures, superscripts and full-width characters in ways you may not want.
  • Transliteration maps characters to ASCII approximations. It is lossy and depends on the language, so the same accented letter may need different treatment in different languages.

Visual effects versus stored changes: reverse, mirror and "fonts"

Several text transformations only look like visual effects but actually work by swapping in different characters. Others change only the display. Knowing which is which tells you what an inspection can detect.

  • "Fancy fonts" from text generators are usually not fonts. They swap letters for characters from the Mathematical Alphanumeric Symbols block (U+1D400 to U+1D7FF) or similar ranges. These are separate stored characters, and a non-ASCII check flags all of them.
  • "Mirror" or "upside-down" text usually swaps letters for look-alike characters from other ranges, such as U+0250 LATIN SMALL LETTER TURNED A. These are also stored changes and are detectable.
  • "Reverse" can mean reversing the stored character order, reversing word order, or only displaying text right-to-left. The first two change the stored text. The third does not.
  • Bidirectional controls such as U+202E RIGHT-TO-LEFT OVERRIDE change how text is displayed without changing the order in which it is stored. The control character itself is non-ASCII and shows up in an inspection, even though the letters around it may all be plain ASCII.
  • CSS effects such as transforms, writing modes or a styled typeface exist only in the page's presentation. They are not characters, so a plain-text inspection of copied text will not reveal them. They also usually do not survive a plain-text copy.

Why naive reversal breaks some characters

Reversing text one code point at a time can produce damaged output. Two cases show why, and an inspection explains the result:

  • Decomposed accents: "cafĂ©" can be stored as c, a, f, e followed by U+0301 COMBINING ACUTE ACCENT. Reversing the code points gives U+0301, e, f, a, c. The accent now comes first with no base letter to attach to. Depending on the renderer, it may appear as a stray mark or on a dotted circle.
  • Multi-code-point emoji: a family emoji can be stored as U+1F468 (man), U+200D (zero width joiner), U+1F469 (woman), U+200D, U+1F467 (girl). Reversing the code points produces a different joined sequence. Many systems will show it as separate figures rather than one combined emoji.

Reversal tools that respect text structure work on grapheme clusters, meaning user-perceived characters, rather than raw code points. If a reversal result looks wrong, inspect it and look for combining marks (category Mn) or U+200D in unexpected positions.

Invisible and look-alike characters worth knowing

Code point | Name | Category | Why it matters
U+00A0 | NO-BREAK SPACE | Zs | Looks like a space but does not match an ordinary space in searches or comparisons
U+00AD | SOFT HYPHEN | Cf | Usually invisible unless a line breaks at that point; can split words in search
U+200B | ZERO WIDTH SPACE | Cf | Invisible; breaks string matching, identifiers and links
U+200C | ZERO WIDTH NON-JOINER | Cf | Required in some scripts; removing it can change spelling
U+200D | ZERO WIDTH JOINER | Cf | Part of many emoji sequences and some scripts
U+200E / U+200F | LEFT-TO-RIGHT MARK / RIGHT-TO-LEFT MARK | Cf | Affect display direction; often picked up when copying from mixed-direction text
U+202A to U+202E | Directional embeddings and overrides | Cf | Can make displayed order differ from stored order
U+2066 to U+2069 | Directional isolates | Cf | Same concern as the embeddings and overrides
U+2060 | WORD JOINER | Cf | Invisible; prevents line breaks
U+FEFF | ZERO WIDTH NO-BREAK SPACE (byte order mark) | Cf | Often appears at the start of files and can break parsers
U+FE0F | VARIATION SELECTOR-16 | Mn | Requests emoji-style display; part of many emoji
U+0430 | CYRILLIC SMALL LETTER A | Ll | Looks identical to Latin a in many fonts; used in look-alike spoofing

Most invisible troublemakers belong to the Unicode format category (Cf). Filtering an inspection report by that category is often more useful than looking at everything non-ASCII. Look-alike letters, by contrast, appear as ordinary letters. Only the code point or script name gives them away.

Running a check locally

If the text is sensitive, running a check on your own machine avoids pasting it into a third-party site. This review does not assess how any online tool handles or keeps submitted text. On systems with GNU grep built with Perl-compatible regex support, the following command lists line numbers containing any byte outside ASCII:

grep -nP '[^\x00-\x7F]' input.txt

For per-character detail, a short Python script prints each non-ASCII character with its position, code point, name and category:

import unicodedata

text = open("input.txt", encoding="utf-8").read()
for i, ch in enumerate(text):
    if ord(ch) > 127:
        print(i, f"U+{ord(ch):04X}", unicodedata.name(ch, "<unnamed>"), unicodedata.category(ch))

An ASCII-only check also misses some problems that are themselves ASCII. Tabs, carriage returns, NUL and other control characters in the U+0000 to U+001F range are invisible too. They pass a non-ASCII filter, so check for them separately if they matter in your pipeline.

Will the result stay readable and usable after copying or sharing?

Invisible characters are ordinary stored characters, so they generally travel with plain-text copy and paste. That is exactly how they end up in code and spreadsheets. Some destinations strip or normalize certain characters on input, but behavior varies by application and version. No scoped tests of specific destinations were provided for this review. The only reliable approach is to paste a sample into the actual destination and inspect what was saved.

  • Reading order: directional controls can make on-screen order differ from stored order. Someone reading, editing or reviewing the text may then see something different from what a program processes. This is why code review tools and compilers have added warnings for these characters in source code.
  • Assistive technology: screen readers announce styled substitute characters, such as mathematical bold or upside-down letters, inconsistently. Depending on the screen reader and its settings, they may be read as individual symbol names or skipped. No scoped screen-reader test is available here, so treat styled-character text as a likely barrier rather than an assumed one.
  • Search and matching: a word written in mathematical alphanumeric characters, or broken up by a zero-width space, usually will not match a search for the plain word. The exception is a search system that normalizes or strips those characters, which you would need to confirm for that specific system.
  • Editing: cursor movement and deletion can behave unexpectedly around invisible characters and combining sequences. For example, one press of backspace may remove only an accent or only part of an emoji sequence.

When a plain-text equivalent is the better choice

Use plain text, or keep a plain-text version alongside the styled one, in the following situations:

  • The text must be found by search, matched exactly, or used as an identifier, password, filename, URL or code.
  • The text must be accessible to screen-reader users. Examples include names, profile bios, headings, alt text and anything essential to understanding the content.
  • Styled or mirrored text is purely decorative. Keep the meaningful content in normal characters and limit the decoration to non-essential parts.
  • You received text from an unknown source and need to confirm that its displayed content matches its stored content.

Keep non-ASCII characters when they are part of the language or meaning: accented names, non-Latin scripts, required joiners and emoji the author intended. In those cases the aim of an inspection is to find unintended characters, not to make the text ASCII.

Gaps in this review

No specific inspection tool, version or test results were supplied. The guidance above relies on general Unicode behavior, not hands-on testing. Any claim about a particular app, platform, browser or screen reader should be confirmed with a test in that environment before relying on it.