utf32.writer

function

Library: UTF-32 (OMFFUTF32)
Import : omffutf32.xmd

Returns: A writable output target for streaming data.


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


Purpose

Use writer to accept UTF-8 encoded data and write that data to a value string sink, converted from a UTF-8 encoding to a UTF-32 encoding. That is, the program writes UTF-8, but the provided output receives a UTF-32 encoding.

The argument encoding can be used to specify a byte ordering.

The argument overlong-handling can be used to specify how overlong UTF-8 sequences should be handled.

Example

The following example takes the output of XML processing and converts it to UTF-32BE before sending it to the output.

  import "omffutf32.xmd" prefixed by utf32.
  
  
  process
     using group "process input"
        using output as utf32.writer in utf32.encoding-utf-32be into #main-output
        do xml-parse scan file #args[1]
           output "%c"
        done
  
  
  group "process input"
     ; ...
            

Related Topics
Other Library Functions