Summary

  • RFC 1843, published in August 1995, described HZ as a seven-bit format for mixing ASCII and GB2312 Chinese text. A tilde-led escape changed how the next bytes were read: ~{ entered GB mode, ~} returned to ASCII, and ~~ yielded a literal tilde.
  • The base decoder read a stream without a line-length rule. The RFC separately recommended that encoders keep physical lines under 80 characters for tools such as more, closing GB mode and consuming ~ followed by a line feed when wrapping would otherwise alter the decoded text.

The punctuation mark had a second job

In the early Internet's ASCII-shaped corridors, an ordinary printable byte could already mean something familiar to an English-speaking reader. A Chinese character often required two bytes in a local eight-bit encoding, and different computer systems stored those characters differently. Fung Fung Lee's HZ document addressed exchange through seven-bit environments, including electronic mail, by using GB2312 as a common Chinese repertoire while leaving ordinary ASCII visible. Its text was published as an RFC in 1995; the abstract says the content matched an article Lee had written in 1989. The date on the RFC is therefore the date of this archival publication, with an earlier design behind it.

HZ used two reading modes. ASCII was the default. In that mode, most ordinary ASCII characters passed through as themselves. A tilde was special: ~~ represented one actual tilde, ~{ moved the reader into GB mode, and a tilde followed by line feed was consumed as a continuation. Inside GB mode, the reader took bytes in pairs until ~} returned it to ASCII. The characters on the paper tape did not announce their meaning one by one; the current mode told the decoder how to group them.

The ranges explain the choice. A GB code in the RFC has a first byte from hexadecimal $21 through $77 and a second from $21 through $7E. Printable ASCII overlaps much of that range. The same byte values therefore needed context. The tilde, $7E, lay outside the allowed first-byte range of a GB pair. It could act as a conspicuous switch without being mistaken for the start of a Chinese character. A mark people used casually in text became the traffic officer at the mode boundary.

The format also kept English passages legible. Apart from tildes that needed doubling, ordinary ASCII remained ordinary ASCII. A message with no Chinese characters and no tilde looked exactly like an ASCII file. HZ was designed for arbitrary alternation between English and Chinese segments rather than a one-way conversion of an entire document. A sender could write an English sentence, enter GB mode for a Chinese phrase, then return to ASCII for the next sentence. A decoder only needed to remember which side of that small gate it occupied.

Line breaks made the story more subtle. A tilde followed by line feed had no decoded output; it let a sender break a long physical line without adding a newline to the underlying text. The RFC says a basic HZ decoder has no need to think in lines at all. A whole file could be one long line, or contain no newlines. The common format was a byte stream with modes and escapes. It asked the decoder to look ahead by at most one character. That was the narrow agreement required to read the content.

Yet real readers had pagers and terminals. The document recommended that an encoder produce lines shorter than 80 characters so tools such as Unix more could handle them conveniently. To do that while GB text was active, the encoder would close the GB segment with ~}, insert the consumed tilde-line-feed continuation and reopen GB mode with ~{ on the next physical line. The file grew slightly. The visible line ended; the decoded text carried on. RFC 1843 explicitly called this an encoding style layered on the basic format. Its examples showed different encoded layouts that produced the same decoded output.

That is HZ's quiet architectural joke. The base reader did not need to know the sender's preferred page width. A writer could choose a line style for a pager, while another could keep a long stream for a different tool. The two writers still spoke the same HZ grammar. The shared rule was small; the packaging decision stayed close to the equipment and audience using it. Lee even noted that the decoder could work backward once the current mode was known, useful to a terminal emulator handling backspaces. The format was meant for live display and editing as well as file exchange.

The later RFC 1922 addressed Chinese Internet messages with ISO-2022-CN and a different set of line-local designation and shift rules. HZ's story lies in its own tilde switch, its two modes and the optional physical-line style above them. One punctuation mark gave seven-bit text a way to carry Chinese bytes while ordinary English could keep walking through the same corridor. The modest wire rule left room for the writer to decide how long the corridor's printed lines should be.