utf32.reader

function

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

Returns: A scannable input source for streaming data.


Declaration
export string source function 
   reader   in value encoding-type encoding   optional 
          from value string source input-data
    


Purpose

Use reader to read a string source and return the text of that source converted from a UTF-32 encoding to a UTF-8 encoding. So, although the provided source is in a UTF-32 encoding, the program sees UTF-8.

The argument encoding can be used to specify a byte ordering. The reader function can determine the byte ordering from the input:

This conforms to Paragraph D101 of the UTF-32 specification. In addition, reader will always discard a byte-order-mark that appears at the beginning of its input if it is the byte-order-mark corresponding to the encoding being processed, regardless of how the encoding was selected.

Example

The following example converts a file from UTF-32LE to UTF-8 for further processing by find rules:

  import "omffutf32.xmd" prefixed by utf32.
  
  
  process
     using group "process input"
        submit utf32.reader in utf32.encoding-utf-32le from file #args[1]
  
  
  group "process input"
     ; ...

Related Topics
Other Library Functions