Long Line Characters in Unicode: How to Identify the Exact Code Point

Several Unicode characters render as a long horizontal line, including em dashes, horizontal bars and box-drawing lines. Learn how to find the exact code point and verify it without changing your text.

A long horizontal line in text can be any of several Unicode characters: an em dash, a horizontal bar, a box-drawing line, a two-em dash, or a run of shorter dashes. Many of them look almost the same on screen, so you cannot reliably tell them apart by eye. To know which one you have, inspect its code point. A code point is the unique number Unicode assigns to each character, written as U+ followed by hexadecimal digits, such as U+2014.

What a Unicode inspector does for your text

A Unicode inspector takes text you paste or load from a file and reports each character separately. For each one it typically shows the code point, the official Unicode character name (for example EM DASH), and often the bytes the character occupies in an encoding such as UTF-8. Inspection only reads the text and does not change it. It tells you which character is present, but it does not decide which character is correct for your document. That depends on your language, style guide or data format.

Characters that commonly appear as a long line

Character | Code point | Unicode name | UTF-8 bytes | Typical use
— | U+2014 | EM DASH | E2 80 94 | Breaks or asides in prose
– | U+2013 | EN DASH | E2 80 93 | Ranges such as 10–20
‒ | U+2012 | FIGURE DASH | E2 80 92 | Dash the width of a digit
― | U+2015 | HORIZONTAL BAR | E2 80 95 | Introducing quotations in some typographic traditions
⸺ | U+2E3A | TWO-EM DASH | E2 B8 BA | Omitted letters or words
⸻ | U+2E3B | THREE-EM DASH | E2 B8 BB | Omitted words or repeated author names in bibliographies
─ | U+2500 | BOX DRAWINGS LIGHT HORIZONTAL | E2 94 80 | Text-based tables and frames
━ | U+2501 | BOX DRAWINGS HEAVY HORIZONTAL | E2 94 81 | Text-based tables and frames
⎯ | U+23AF | HORIZONTAL LINE EXTENSION | E2 8E AF | Building long lines from pieces
− | U+2212 | MINUS SIGN | E2 88 92 | Mathematics
• | U+002D | HYPHEN-MINUS | 2D | The ordinary keyboard hyphen

Several other characters can look like a line in some fonts. These include U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK (ー), U+4E00 the CJK ideograph for "one" (一), U+FF0D FULLWIDTH HYPHEN-MINUS (-) and U+FE58 SMALL EM DASH (﹘). Width and thickness depend on the font. Some fonts have no glyph for the rarer dashes and fall back to another font or display an empty box. Treat the rendered appearance as a hint only, and treat the code point as the answer.

Step by step: identify the character

  • 1. Copy the line exactly as it appears in the source. Do not retype it, because retyping replaces the original character with whatever your keyboard produces.
  • 2. Check whether the line is one character or several. Two em dashes in a row (——) are two code points, while a two-em dash (⸺) is one. A good inspector lists each code point on its own row.
  • 3. Inspect the text with one of the methods below and note the code point and name.
  • 4. Verify the result by recreating the character from its code point and comparing it with the original.

Method 1: Python

Python's standard unicodedata module returns the official name for each character. The script below is an example. Paste your text between the quotes.

import unicodedata

text = "a—b"
for ch in text:
    print(f"U+{ord(ch):04X}  {unicodedata.name(ch, '<no name>')}  {ch.encode('utf-8').hex(' ')}")

For the sample string, the expected output follows from the Unicode character data. It is shown here for illustration and was not captured from a test run.

U+0061  LATIN SMALL LETTER A  61
U+2014  EM DASH  e2 80 94
U+0062  LATIN SMALL LETTER B  62

Method 2: Command line bytes

On Linux or macOS with a UTF-8 terminal, you can dump the raw bytes and match them against the UTF-8 column in the table above. In this example, the em dash should appear as the byte sequence e2 80 94. An extra 0a at the end means a newline was included.

printf '%s' '—' | od -An -tx1

Method 3: Tools that need no code

  • Microsoft Word on Windows: place the cursor right after the character and press Alt+X to replace it with its hexadecimal code point. Press Alt+X again to convert it back.
  • macOS Character Viewer: open it with Control+Command+Space and expand it to see the character name and code point.
  • Linux GTK applications: type Ctrl+Shift+U, then the hexadecimal code, then Space or Enter to insert a character by its code point. This is useful for the verification step.
  • Browser developer console: run "—".codePointAt(0).toString(16) to get the hexadecimal code point. For an em dash the result is 2014.
  • Dedicated Unicode inspector web tools and apps: paste the text and read the per-character breakdown.

Keyboard shortcuts and menu locations can vary between software versions and system settings. Confirm them in your own setup.

Verify the result

Verification has two parts. First, recreate the character from the code point you found and check that it matches the original. In Python, for example, the expression ch == "\u2014" returns True only for an actual em dash. Second, search the document for that exact code point to find every occurrence. Searching by code point avoids accidentally matching lookalikes. With GNU grep built with PCRE support and run in a UTF-8 locale, the following example lists matching lines with their line numbers.

grep -nP '\x{2014}' file.txt

Avoid unintended changes

Once you know which character you have, confirm it is actually wrong before you replace it. A minus sign (U+2212) in a formula, box-drawing lines in a plain-text table, and the prolonged sound mark (ー) inside a Japanese word all carry meaning. Swapping them for a dash or hyphen can break alignment or change the content. Unicode normalization will not reliably clean up dashes for you either. NFKC normalization maps U+FE58 SMALL EM DASH to U+2014 and U+FF0D FULLWIDTH HYPHEN-MINUS to U+002D. However, it leaves U+2014 EM DASH and U+2015 HORIZONTAL BAR as distinct characters. If you need consistency, replace by explicit code point, review each match in context, and keep a copy of the original text.

Limits of this guide

No product-specific evidence was supplied, so this guide does not compare or rate particular Unicode inspector tools. The code points, names and UTF-8 byte sequences listed come from the Unicode standard's character data. Font coverage and shortcut behavior depend on your system and should be checked locally.