218; Unicode Extended Utf16 Encoding Example - TransAct Epic 3000 Programmer's Manual

Table of Contents

Advertisement

Extended Printer Control
T480
UTF-16
UTF-16 is the most straightforward way to access characters above 255. UTF-16
essentially sends two 8-bit bytes that form a 16-bit address to access the desired
character. Basic UTF-16 does not define the byte order. If you wish to use UTF-16 and
allow the printer to determine the byte order, you must send the byte order mark
(0xFEFF) before you send any characters. To prevent loss of byte order
synchronization, you should periodically send the byte order mark to resynchronize the
printer with your application. If UTF-16 is selected, all data sent to the printer must be
16 bits. All commands and command parameters are also 16 bit, however only values
between 0 and 255 are valid. Extended addressing uses surrogate pairs to encode
values above 0xFFFF.
Scalar Value
xxxxxxxxxxxxxxxx
000uuuuuxxxxxxxxxxxxxxxx 110110wwwwxxxxxx
Note: wwww = uuuuu – 1 and uuuuu may not be larger than 10000

Unicode Extended UTF16 Encoding Example

3 Byte output Example
Hex Character Code: 0x00010302
00
00000000
00000001
00000000 000
Discarded
0000000000
1101100000000000
1101
1000
0000 0000
0xD800 0xDF02
UTF-16
With UTF16 values from 0x0000000000 to 0x0000D7FF and 0x0000E000 to
0x0010FFFF may be represented Values from 0x0000D800 to 0x0000DFFF and above
0x0010FFFF are not valid and in fact are not valid for any characters in Unicode rev 5.0
regardless of encoding.
UTF-16BE uses the big-endian method of sending the two bytes. This method sends the
high byte first and then the low byte. It is not required to send the byte order mark
Page 218
xxxxxxxx xxxxxxxx
01
03
02
00000011 00000010
00001
000000
11 00000010
0000
000000
11 00000010
1100000010
1101111100000010
1101
1111 0000 0010
Rev A
T480 Programmer's Guide
UTF-16
110111xxxxxxxxxx
- Original Hex Code(s)
- Converted to Binary
- Bit Sections
- Adjusted by subtracting
1 from uuuuu
- Merged into two
10 bit values
- Surrogates added
- 2 16 bit values
- 2 16 bit hex values
100-14362

Advertisement

Table of Contents
loading

Table of Contents