iso8859.writer

function

Library: ISO/IEC 8859 (OMFF8859)
Import : omff8859.xmd

Returns: A writable output target for streaming data.


Declaration
export string sink function 
   writer   in value encoding-type encoding    optional
          into value string sink   output-data


Purpose

Use iso8859.writer to accept UTF-8 encoded data and write that data to a value string sink, converted from a UTF-8 encoding to an ISO/IEC 8859 encoding. That is, the program writes UTF-8, but the provided output receives one of the ISO/IEC 8859 encodings. Use the encoding argument to specify the desired encoding.

If the data being written to iso8859.writer contains a UTF-8 sequence that cannot be represented in the selected encoding, a throw to iso8859.invalid-code-point is triggered.

Example

The following example takes the output of XML processing and converts it to ISO/IEC 8859-8 before sending it to the output.

  import "omff8859.xmd" prefixed by iso8859.
  
  process
     using group "process input"
        using output as iso8859.writer in iso8859.encoding-8859-8 into #main-output
        do xml-parse scan file #args[1]
           output "%c"
        done
  
  group "process input"
     ; ...

Usage Note

To use iso8859.writer, you must import OMFF8859 into your program using an import declaration such as:

  import "omff8859.xmd" prefixed by iso8859.

Other Library Functions