Character encodings, international (OMEFIO)

The omefio library allows you to do a variety of character encoding conversions on file input or output. The available conversions include:

  • JIS ("Japanese Industry Standard" (JIS X 0201, JIS X 0208, and JIS X 0212)) character encoding to UTF-8 on file input
  • UTF-8 to JIS character encoding on file output
  • sJIS ("Shift JIS") character encoding to UTF-8 on file input
  • UTF-8 to sJIS character encoding on file output
  • EUC ("Extended UNIX Code") character encoding to UTF-8 on file input
  • UTF-8 to EUC character encoding on file output
  • UTF-16 to UTF-8 character encoding on file input
  • UTF-8 to UTF-16 character encoding on file output
  • Big 5 to UTF-8 character encoding on file input
  • UTF-8 to Big 5 character encoding on file output

Also included in this function library is one external source function (input-file) and one external output function (output-file) that provide basic file input and output functionality. These functions duplicate basic OmniMark file input and output processes, with one notable exception: if a file i/o error is encountered when doing "regular" OmniMark file processing, your program will terminate. The input-file and output-file functions, however, make use of the "exceptions-to" optional argument, allowing file I/O errors to be noted without terminating the program. This error handling is beneficial in server programs where program termination is often unacceptable.

Big 5 is a Chinese character set encoding that specifies 13,494 Chinese characters. It is the most widely used encoding in Taiwan and its name refers to the five companies that collaborated in its development in 1984.

Note that not all legitimate Big 5 characters have a corresponding UTF-8 encoding, so occasionally you will lose data during a conversion. OmniMark will issue a warning when such a data loss occurs.

The international character encodings library, omefio, depends on the OmniMark I/O exception object library (omioe). This means that omioe must be included in the program before omefio, as shown:

  include "omioe.xin"
  include "omefio.xin"