big5.reader

function

Library: Big5 (OMFFBIG5)
Import : omffbig5.xmd

Returns: A scannable input source for streaming data.


Declaration
export external string source function reader
                  from value string source input-data


Purpose

Use reader to read a value string source, its argument, and return the text of that file converted from a Big 5 encoding to a UTF-8 encoding. That is, the provided source is in Big 5, but the program sees UTF-8

Usage Note

To use reader, you must import omffbig5.xmd into your program using a statement like this:

  import "omffbig5.xmd" prefixed by big5.

(Please see the import topic for more on importing.)

Example


  ; Scan the Big Five-encoded file named by the first
  ; command-line argument to the program's find rules,
  ; converting from Big Five to UTF-8 prior to the match
  ; alternatives seeing the data:
  import "omffbig5.xmd" prefixed by big5.
  process
     repeat scan big5.reader from file #args [1]
     match ["%0#"  to "%127"]+ => plain-ascii
        output plain-ascii
     match (any ["%128#" to "#255#"]+) => utf-8-code
        ; process utf-8-code
     again

Related Topics
Other Library Functions