Codepackr / edi / EDI Delimiter Swapper & Normalizer

EDI Delimiter Swapper & Normalizer

Swap element/segment delimiters, enforce strict 106-character ISA envelope padding, and clean carriage returns.

Client-Side Execution & Privacy Guarantee

This utility executes 100% locally in your web browser. Your inputs, tokens, queries, and data payloads are never transmitted to any external server or backend.

Trading partners frequently require non-default delimiters or reject files that contain unexpected line endings. The EDI Delimiter Swapper & Normalizer rewrites element separators, segment terminators, and sub-element separators while guaranteeing that the ISA segment remains exactly 106 characters.

Carriage returns and line feeds that appear outside of element data are stripped, producing a clean interchange that parsers can read without additional preprocessing. All work is performed locally.

Fixed-Length ISA Enforcement

The ISA segment is the only fixed-length segment in X12. Its total length, including the final segment terminator, must be 106 characters. The converter measures the ISA, pads or truncates authorization and security fields as required, left-justifies and space-pads the 15-character sender and receiver IDs, and places the component-element separator in position 105.

If the original ISA is malformed, the tool reconstructs a valid envelope from the detected delimiters and the partner IDs so downstream systems do not reject the file on envelope length alone. Interchange control numbers are zero-padded to nine digits.

Delimiter Swapping

You specify the desired element delimiter, segment terminator, and (for X12) the component-element separator. The converter scans the entire interchange, replaces every occurrence of the old delimiters, and rewrites the ISA so that the new delimiters are correctly declared in positions 4, 105, and 106.

EDIFACT files are handled by updating or inserting a UNA segment that reflects the new service-string advice. Data values that legitimately contain the old delimiter characters are left untouched so business content is preserved.

Carriage-Return Cleaning

Many EDI files arrive with CR, LF, or CRLF inserted between segments or even inside elements. The normalizer removes all control characters that are not part of the chosen segment terminator, then re-applies a single consistent terminator after every segment.

The result is a single continuous stream or a clean one-segment-per-line file, whichever you prefer, with no residual platform-specific line endings that could confuse strict parsers.

When to use this tool

  • A partner rejects files because the ISA is not exactly 106 characters.
  • Convert asterisk/tilde delimiters to pipe/caret for a specific VAN.
  • Strip Windows CRLF sequences that cause parser errors on Unix systems.
  • Normalize a batch of mixed-delimiter test files before loading them into a mapper.
  • Prepare an EDIFACT message with a non-standard UNA for a European partner.

How to use the EDI Delimiter Swapper & Normalizer

  1. Paste the raw EDI document.
  2. Confirm or override the detected current delimiters.
  3. Choose the target element delimiter, segment terminator, and sub-element separator.
  4. Enable Enforce 106-character ISA (recommended for all X12 files).
  5. Enable Remove stray CR/LF if the file contains extra line breaks.
  6. Click Normalize. The rewritten interchange appears immediately.
  7. Copy or download the result and re-validate if desired.

Worked examples

ISA length repair

Input
ISA*00* *00* *ZZ*SHORT*ZZ*RECV*241112*0000*U*00401*1*0*P*>~GS*PO*SHORT*RECV*20241112*0000*1*X*004010~ST*850*0001~BEG*00*SA*PO1**20241112~SE*3*0001~GE*1*1~IEA*1*1~
Output
ISA*00*          *00*          *ZZ*SHORT          *ZZ*RECV           *241112*0000*U*00401*000000001*0*P*>~GS*PO*SHORT*RECV*20241112*0000*1*X*004010~ST*850*0001~BEG*00*SA*PO1**20241112~SE*3*0001~GE*1*1~IEA*1*000000001~

Sender and receiver IDs are space-padded to 15 characters; ISA is now exactly 106 characters; control number is zero-padded to 9 digits.

Delimiter swap and CR removal

Input
ISA|00|          |00|          |ZZ|ACME           |ZZ|RETAIL         |241112|0000|U|00401|1|0|P|>\r\nGS|PO|ACME|RETAIL|20241112|0000|1|X|004010\r\nST|850|0001\r\n
Output
ISA*00*          *00*          *ZZ*ACME           *ZZ*RETAIL         *241112*0000*U*00401*000000001*0*P*>~GS*PO*ACME*RETAIL*20241112*0000*1*X*004010~ST*850*0001~

Pipes replaced by asterisks, CR/LF removed, segment terminator changed to tilde, ISA length corrected.

Common mistakes and tips

  • Always re-check ISA length after a delimiter swap; the converter does it automatically, but a manual spot-check is good practice.
  • Do not choose a delimiter that already appears inside element data; the tool will not escape it.
  • Zero-pad interchange control numbers to nine digits; many partners reject shorter values.
  • For EDIFACT, keep the UNA segment as the first line so receiving systems know the new delimiters.
  • After normalization, run the file through the EDI formatter if you need human-readable indentation.

Frequently asked questions

Why must the ISA be exactly 106 characters?

The X12 standard defines the ISA as a fixed-length segment so parsers can extract delimiters from known byte positions without scanning the rest of the file. Any other length causes immediate rejection.

Does the tool modify business data inside elements?

No. Only delimiter characters and the fixed-length envelope fields are rewritten. Element values remain byte-for-byte identical.

Can it handle files that already contain the target delimiter inside data?

The converter replaces delimiters globally. If your data contains the new delimiter character, choose a different character or escape the data first.

What happens to existing line breaks?

All CR and LF characters that are not the chosen segment terminator are removed. You may then request one segment per line if desired.

Is the process reversible?

Yes. Run the output through the converter again with the original delimiters to restore the previous form.