I want to encode the string "QuiÑones" in a Code 128 bar code. Is it possible to include extended ASCII characters in the Code 128 encoding? .
I did some research on Google which suggested that it is possible by using FNC4, but I didn't find exactly how to do it. It would be of great help if some one could assist me with a solution in the C language.
"Extended ASCII" characters with byte values from 128 to 255 can be represented in Code 128 encodation by using the special FNC4 function character. For general use (in open applications) it is necessary that such extended characters belong to the ISO-8859-1 (Latin1) character set.
"FNC4 is used to represent an extended character set (byte values 128 to 255) as specified in ISO/IEC 8859-1 ... If a single FNC4 character is used, the value 128 is added to the ISO/IEC 646 value of the following data character in the symbol ... Subsequent data characters revert to the standard ISO/IEC 646 set. If two consecutive FNC4 characters are used, the value 128 is added to the ISO/IEC 646 value of all following data characters until two further consecutive FNC4 characters are encountered or the end of the symbol is reached." — ISO/IEC 15417 §4.3.4.2 (d)
In effect, a single FNC4 character toggles the high-bit of the next character (treated as an 8-bit ordinal), whereas two adjacent FNC4 characters toggles the high-bit for subsequent characters.
In your example "QuiÑones" the character "Ñ" is represented by byte value 209 in ISO-8859-1, so that's 128+81. ASCII 81 resolves to "Q", so you require the sequence FNC4 Q
to represent "Ñ".
An efficient Code 128 encodation of this data is as follows:
[104/START-B] [49/Q] [85/u] [73/i] [100/FNC4] [49/Q] [79/o] [78/n] [69/e] [83/s] [93/check-digit] [106/STOP]
Some barcode applications and libraries will perform the FNC4-based extended character encoding for you, as in the example below. The majority don't but these should allow you to specify an FNC4 character directly so that you can manually drive the process using the above technique, e.g: Qui{FNC4}Qones
The Code 128 symbol looks like this: