About this Escape Tool
HL7 v2 uses reserved delimiter characters to split fields, components, repetitions, and subcomponents. When those characters need to appear as data instead of structure, they should be escaped. This tool helps you convert between raw text and the common HL7 escape sequences used in many v2 interfaces.
Who this calculator is for
- Interface analysts and developers assembling HL7 fields that contain literal separator characters.
- Teams debugging why a note, comment, or identifier is splitting into unexpected components.
- Students learning the core HL7 v2 escape sequences and what each one represents.
When to use it
- Use it before placing free text into an HL7 field that might contain pipes, carets, tildes, or ampersands.
- Use it when reading a message and you want to decode common HL7 escape sequences back into plain text.
- Use it to create small test values for interface-engine maps, transformations, and unit checks.
How to use this calculator
- Select Encode to HL7 to convert raw text with special characters into a safe HL7 string.
- Select Decode from HL7 to convert an escaped HL7 string back into readable text.
- Enter your text in the input box.
Key assumptions
- This tool uses the standard HL7 v2 reserved characters and their common escape sequences: field, component, repetition, subcomponent, and escape.
- It does not read custom delimiters from an MSH segment, so it is best for standard separator scenarios and quick transformations.
- The converter handles the basic text substitutions only and does not process formatting escapes such as highlight, hexadecimal, or local implementation-specific extensions.
Accuracy and testing
Review formula sources, default test cases, assumptions, unit handling, rounding rules, and changelog for this calculator.
How this calculator works
Inputs explained
Input Text
The string containing special characters or escape sequences.
Action
Encode (Text -> HL7) or Decode (HL7 -> Text).
Understanding your results
Example scenarios
Encoding
Input: 'Smith & Jones'. Result: 'Smith \T\ Jones'.
Decoding
Input: 'Note: \F\ split'. Result: 'Note: | split'.
Key Features
- Full Escape Support
- Bidirectional Logic
- Instant Processing
Tips & Best Practices
- Always escape user input before placing it into an HL7 message construction function.
- The escape character itself (`\`) must be escaped (`\E\`) first to avoid recursion issues.
Glossary of Terms
- Delimiter
- A character used to separate data fields (e.g., Pipe, Hat, Ampersand).
- Escape Sequence
- A combination of characters used to represent a reserved character.