function
Library: ISO/IEC 8859 (OMFF8859)
Import : omff8859.xmd |
Returns: A writable output target for streaming data. |
export string sink function writer in value encoding-type encoding optional into value string sink output-data
Use 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.
If the data being written to writer
contains a UTF-8 sequence that cannot be represented in the
selected encoding, a throw
to iso8859.invalid-code-point
is triggered.
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" ; ...