encode-ITA_2 (original) (raw)
8.15
Be aware if you site this that I used Wikipedia as my source 😅. (The only thing I sourced was the table from characters to values)
Encodes strings in the 5 bit ITA2 character encoding.
ITA2 is a modification to Baudot Code.
I made this library because I needed a character encoding as small as possible, and I didn’t want to design my own. UTF-8 is 8 byes wide and Ascii is 7 bits. Shaving an extra two bits was (at the time) desireable. I’ve heard rumors of an official UTF-4 (designed for 4 bit computers, perhaps not unlike the Intel 4004), but I haven’t been able to find a spec for this format. If you do find it anywhere, I’d love to write the library for that.
Works out of the box with ‘typed/racket‘
Converts input into a list of numbers representing the encoding of your text as ITA_2 format.
Be aware that the length of the returned list is usually going to be longer than the number of chars represented. That’s because, like in Unicode, control codes indicate which bank of characters are being addressed.
The returned numbers range from 0 to 31. This makes ITA_2 a 5 bit system.
input may only be composed of characters within this set:
- #\nul
- Any of "ABCDEFGHIJKLMNOPQRSTUVWXYZ"(standard English alphabet, uppercase only)
- #\newline
- #\return
- Any of "0123456789" (standard decimal number set)
- Any of "-',!:(+)£?&./;"
- #\u0007 (the bell character, for use in terminals)
- #\u0005 (the enq character, for use in terminals)
- #\rubout (the delete character, for use in terminals)
Just be aware: ITA and its dereviatives are not compatible with Ascii or any Unicode.
An alias to string->ita_2 (see above).