Sample Data Line Endings
An exciting new feature in Iguana 5.6.6 is an enhancement to the sample data editor. In this editor, you can modify the messages the Iguana Translator uses to generate annotations while you develop your interface, and you can also create new messages.What’s new for 5.6.6 is the way the editor treats line endings. They are now displayed as visible tokens, which gives you greater control over the exact structure of your sample data.
Why do line endings matter?
Line endings are invisible characters that indicate the end of a line of text. They date back to the days of the telegraph, when they were used to send instructions to printers. A newline (frequently written as NL or \n) character meant move the paper up, and a carriage return (CR or \r) meant move the printer head to the starting position. These characters are still around today, although their use is quite detached from their original meaning, and they frequently mean different things in different contexts.
- In Windows text files, the end of a line is marked with \r\n.
- In Unix-like environments (including Macs), the traditional line end in a text file is a single \n.
- In an HL7 message, lines end with a single \r, and the message itself ends with \r\n.
- In HTTP requests, each line of the header ends with \r\n.
- … and so on.
No matter what sort of messages you’re using as sample data, you need to be sure the line endings are correct for that message type. In the sample data editor, these line endings are now visible (as literal \n or \r), and you can move them around or add new ones at your discretion. When you save a sample message, these tokens are transformed back into the real invisible line end characters.
A few things to remember:
- any line breaks you enter in the editor simply by pushing “enter” or “return” will be discarded when you save your message. Only the visible tokens will become real line endings.
- When you paste text into the editor, invisible line endings in the pasted text will be transformed into visible tokens.
- If you paste in text that already contains literal \n or \r tokens, they will be preserved. If you are copying a sample message from the editor to make a new one, this will be the case, and Iguana will do the right thing.
- If the type of message you’re working with has specific line ending requirements, and if you’re copying it in from another program, it’s a good idea to double-check the line endings once you have the message open in the editor. (Some operating systems will change line endings as you copy and paste.)