UN/EDIFACT UNA / UNB Envelope Rules & ?' Release Character Escaping
Writing or debugging a UN/EDIFACT parser requires mastering two ISO 9735 rules that differ fundamentally from ASC X12: the 9-byte UNA header and stateful ? release-character escaping.
Exact 9-Byte UNA Service String Advice Map (0..8)
| Byte Index | Default Char | ISO 9735 Role |
|---|---|---|
0..2 | UNA | Literal 3-character Service String Advice tag. |
3 | : | Component data element separator (sub-elements inside a composite). |
4 | + | Data element separator. |
5 | . | Decimal notation mark (. or European , — parsers must normalize before BigDecimal math!). |
6 | ? | Release (escape) character — escapes the immediately following syntax character. |
7 | (space) | Reserved (space in Syntax Version 3; repetition separator * in Syntax Version 4). |
8 | ' | Segment terminator. |
Why String.split("'") Corrupts Production EDIFACT Files
// Look closely at NAD-04 Party Name below:
NAD+BY+5412345000013::9++L?'OREAL PARIS:DEPT D?'ACHAT+RUE ROYALE 14+PARIS++75008+FR'
// ^^ ^^
// ?' is a literal apostrophe inside free text — NOT a segment terminator!
// Meanwhile, a literal question mark at the end of a field is encoded as ??' (escaped ? followed by real ' terminator)!
EdiPrism's Free-Tier single-line wrapper (Alt+Shift+E) tracks parity of consecutive release characters so ?' stays intact while ??' wraps cleanly.

Frequently Asked Engineering Questions
Does UNT-01 count UNA and UNB?
No. UNT-01 counts only the segments inside that single message starting at UNH and ending at UNT inclusive (just like X12 SE-01 counts ST..SE inclusive). UNB and UNZ sit outside the message envelope.
Inspect, Diff, Validate & Scrub This Payload Offline in Your JetBrains IDE
Never paste regulated healthcare PHI (837/835/271) or supply-chain payloads (850/ORDERS) into browser parsers. EdiPrism X12 EDIFACT runs 100% air-gapped inside IntelliJ IDEA, PyCharm, DataGrip, Rider, GoLand, and WebStorm with a free core tier and a 14-day [Pro] trial.