Structure and Use
In the HZ encoding system, the character sequences "~{" and "~}" act as escape sequences; anything between them is interpreted as Chinese encoded in GB2312 (the most significant bits are ignored). Outside the escape sequences, characters are assumed to be ASCII.
An example will help illustrate the relationship between GB2312, EUC-CN, and the HZ code:
| Form | Code | With escape sequences | Remarks |
|---|---|---|---|
| Kuten / Qūwèi / 区位 form | 5027 | — | Zone (ku/qū/区) 50, point (ten/wèi/位) 27 |
| ISO 2022 form | 5216 3B16 | 0E16 5216 3B16 0F16 | 50 + 32 = 82 = 5216 |
| EUC-CN form | D216 BB16 | D216 BB16 | 5216 ∨ 8016 = D216 |
| HZ form (standard) | 5216 3B16 | 7E16 7B16 5216 3B16 7E16 7D16 | Appears as ~{R;~} without HZ decoder |
| HZ form (alternate) | D216 BB16 | 7E16 7B16 D216 BB16 7E16 7D16 | EUC form acceptable to at least some decoders |
HZ was originally designed to be used purely as a 7-bit code. However, when situations allow, the escape sequences "~{" and "~}" sometimes surround characters represented in EUC-CN; this alternative use allows Chinese to be readable either with the help of HZ decoder software, or with a system that understands EUC-CN.
Additionally, the specification defines that
- the sequence "~~" is to be treated as encoding a single ASCII "~"
- the character "~" followed by a newline is to be discarded.
However, not all HZ decoders follow these two rules.
Read more about this topic: HZ (character Encoding)
Famous quotes containing the words structure and and/or structure:
“With sixty staring me in the face, I have developed inflammation of the sentence structure and definite hardening of the paragraphs.”
—James Thurber (18941961)
“The structure was designed by an old sea captain who believed that the world would end in a flood. He built a home in the traditional shape of the Ark, inverted, with the roof forming the hull of the proposed vessel. The builder expected that the deluge would cause the house to topple and then reverse itself, floating away on its roof until it should land on some new Ararat.”
—For the State of New Jersey, U.S. public relief program (1935-1943)