Version 2.0 The HZ package 2.0 contains the following major changes: hz2gb 2.0, zw2hz 2.0 ------------------------------------------------------------------------------ hz2gb 2.0: convert a HZ file to a GB (HGB/SGB) file The HZ specification does not dictate how to convert invalid HZ files, just as the definition of a programming language usually does not specify how a compiler should handle illegal programming constructs. The error recovery procedure of this HZ decoder was designed after examination of the conversion errors reported by hz2gb 1.1 of some of the "HZ" files posted on the news group alt.chinese.text. I suspected that most of the errors occured due to improper manual insertion of escape sequences, and/or using invalid GB codes, such as those for "space" ($2121). Such errors should not have occured if the files were first properly edited as GB codes, and then converted by an HZ encoder, such as gb2hz (preferably with the -t option.) To prevent some hanzi displayers from ill behaviour, the output stream should be or should be corrected to be valid mixed ASCII and GB sequences. The error recovery procedure is by no means unique, and may change in the future. Users should NOT regard the error recovery features as part of the HZ specification. ------------------------------------------------------------------------------ zw2hz 2.0: do a straightforward conversion from a zW file into a HZ file This version was an update of version 1.1, because the specification of zW had been changed by the original authors. Since the set of all zW files is a proper subset of the set of all HZ (HGB) files, it is always possible to do perfect translation from zW to HZ (HGB); but not vice versa. * HGB - High-bit-set GB, as used in CCDOS, Macintosh System 6.0.x and later. As for error handling, I took the lazy approach. For example, if the original zW file contains invalid GB codes, they will also show up in the output HZ file, and can be detected by "hz2gb -v". ------------------------------------------------------------------------------ Version 1.1 CONTENTS This package contains some utilities related to HZ, a data format for exchanging files of arbitrarily mixed Chinese and ASCII characters. INSTALLATION If you want GB utilities (for CCDOS, Macintosh Chinese System 6.0 or later): make gb If you want shift GB utilities (for Macintosh Chinese System 1.2): make sgb If you want everything: make all USAGE hz2gb: recommended option: hz2gb < foo.hz > foo.gb gb2hz: recommended option: gb2hz -t < foo.gb > foo.hz (-t selects "terminal" style of HZ. See the file "HZ.spec".) hz2sgb: recommended option: hz2sgb -n < foo.hz > foo.sgb (-n turns UNIX's LF to MAC's CR) sgb2hz: recommended option: sgb2hz -n -t < foo.sgb > foo.hz (-n turns MAC's CR to UNIX's LF; -t selects "terminal" style of HZ.) zw2hz: recommended option: zw2hz < foo.zw > foo.hz (The old -a and -c options are now obsolete.) If you want a more compact hz file, do zw2hz < foo.zw | hz2gb | gb2hz > foo.hz OR zw2hz < foo.zw | hz2sgb | sgb2hz > foo.hz **Unless you have zW files, don't worry about 'zw2hz'. ) BUG REPORT Bug reports are to be sent to Fung F. Lee at lee@umunhum.stanford.edu.