How to Identify the Unit Separator Control Character
Learn what the Unit Separator (US, U+001F) control character is, how to detect it in text with hex viewers, grep, Python and regex, and how to verify the result safely.
The Unit Separator is an invisible control character. It can sit inside a text file, a database export or a copied string without displaying anything on screen. It is not visible, so the reliable way to detect it is to check the underlying code point, not the rendered text. This guide explains what the character is, what it does to your text, and how to find it and confirm what you found.
What the Unit Separator is
The Unit Separator (abbreviated US) belongs to the C0 control characters, the first 32 code points inherited from ASCII. Its identifiers are the same in ASCII and Unicode:
| Property | Value |
| Unicode code point | U+001F |
| Decimal | 31 |
| Hexadecimal | 0x1F |
| Octal | 037 |
| Caret notation | ^_ |
| Unicode name aliases | INFORMATION SEPARATOR ONE, UNIT SEPARATOR |
| General category | Cc (control) |
| UTF-8 / ASCII bytes | 1F |
| UTF-16 bytes | 1F 00 (little-endian) or 00 1F (big-endian) |
| Visible stand-in glyph | ␟ (U+241F SYMBOL FOR UNIT SEPARATOR), which is a different character |
What it does to your text
The Unit Separator marks a boundary between the smallest pieces of data, called units or fields. It is the lowest level of a four-level separator hierarchy. US separates fields, RS (Record Separator, U+001E) separates records, GS (Group Separator, U+001D) separates groups, and FS (File Separator, U+001C) separates files. Some systems use US as a field delimiter instead of commas or tabs, because it rarely appears in ordinary writing. That means field values can contain commas and tabs without escaping.
In most editors and web pages the character has no visible effect. Two words separated only by U+001F can look joined, for example "idname", or can show a box or a placeholder glyph, depending on the font and the software. The character is still present. It can break exact-match searches, string comparisons, validation rules and imports that do not expect it.
Programs can also treat it in ways you might not expect. In Python, '\x1f'.isspace() returns True, because the character's bidirectional class is Segment Separator. As a result, str.split() with no arguments splits on it. In contrast, str.splitlines() treats U+001C, U+001D and U+001E as line boundaries but not U+001F. Check how your own tool classifies the character before you rely on its default whitespace or line handling.
Step 1: Create or isolate a sample
Work on a copy of the text, or on a small excerpt, so that inspection cannot change the original. To practice, this illustrative command writes a three-field line that uses US as the delimiter. Octal escapes keep it portable across printf implementations:
printf 'id\037name\037city\n' > sample.txt
Step 2: View the raw bytes
A hex viewer shows the character directly, without relying on a font. In UTF-8 or ASCII text, look for the byte 1f. Some viewers print a dot in the text column, and a dot is also used for many other non-printable bytes, so read the hex column, not the text column.
xxd sample.txt
od -c sample.txt
cat -v sample.txt
Expected behavior (not shown as verified output): xxd lists 1f between the bytes of each word. od -c shows the character as its octal code 037. cat -v displays it in caret notation as ^. Do not confuse ^ with a literal caret followed by an underscore. Confirm with the hex view.
Step 3: Search for it
To find which lines contain the character, or how many times it occurs, pass the actual byte to the search tool. In bash, the $'...' quoting form turns \x1f into the real character:
grep -n $'\x1f' sample.txt # lines containing US, with line numbers
grep -c $'\x1f' sample.txt # number of lines containing US
tr -cd '\037' < sample.txt | wc -c # total number of US characters
In regular expression engines that support escapes, the pattern is usually written as \x1F or \u001F. To catch every C0 or C1 control character at once, engines that support Unicode properties accept \p{Cc}. Escape syntax varies between engines, so check your tool's documentation.
Step 4: Confirm the exact code point
Locating a suspicious invisible character is only half the job. You also need to confirm it is U+001F and not a neighboring separator or another control character. This illustrative Python script reports every control character with its position and code point:
import unicodedata
with open('sample.txt', encoding='utf-8') as f:
text = f.read()
for i, ch in enumerate(text):
if unicodedata.category(ch) == 'Cc':
print(i, f'U+{ord(ch):04X}')
Each Unit Separator appears as U+001F. The newline at the end of the line also appears, as U+000A, because it is a control character too. Note that unicodedata.name() raises an error for control characters, because they have no formal Unicode name, only aliases. unicodedata.lookup('UNIT SEPARATOR') does accept the alias and returns the character. In JavaScript, the equivalent check is str.charCodeAt(i) === 31, or the literal '\u001f'.
Telling it apart from similar characters
| Character | Code point | Caret notation | UTF-8 bytes | Role |
| Unit Separator (US) | U+001F | ^_ | 1F | Separates fields/units |
| Record Separator (RS) | U+001E | ^^ | 1E | Separates records |
| Group Separator (GS) | U+001D | ^] | 1D | Separates groups |
| File Separator (FS) | U+001C | ^\ | 1C | Separates files |
| Symbol for Unit Separator (␟) | U+241F | none (printable) | E2 90 9F | Visible picture of US, not a control character |
The ␟ glyph is a common source of confusion. Some tools display it in place of a real U+001F, and some documents contain the glyph itself as ordinary text. Only the byte view tells you which one is present. A real US is the single byte 1F in UTF-8. The glyph is the three bytes E2 90 9F.
Making it visible without changing the data
To review the text by eye, write a display copy that replaces US with a visible marker, and leave the source file untouched. Choose a marker that does not already occur in the text. Otherwise you cannot tell real separators from original content afterward. This illustrative command uses the ␟ glyph as the marker:
sed $'s/\x1f/␟/g' sample.txt > sample.visible.txt
If the character is a deliberate delimiter, keep it in the working data and use the marked copy only for reading. If it is an unwanted artifact, for example left over from a copy-paste or an export, decide whether to delete it or replace it with a space or a standard delimiter. Deleting it can merge adjacent words or fields, so make sure that result is what you want.
Verifying the result
- Count the US characters before any change, using tr -cd '\037' < file | wc -c, and record the number.
- After a replacement, count again in the output. The US count should be zero, and the marker count should equal the original US count.
- Compare the file size, or run a diff of the original and the output, to confirm that nothing else changed.
- If the text came from a structured export, check that the number of fields per record is the same before and after.
Gaps in this guide
No source-specific evidence was supplied for this article. It covers no particular product's handling of the Unit Separator, no compatibility test results and no measured output. The character's identifiers and the behavior of standard tools described here follow published standards and documented defaults. The command and code samples are illustrations and have not been run as part of this guide. Editors, terminals, fonts and import tools differ in how they display or strip control characters, so confirm the behavior in the specific software you use.