swirl
Guide to OmniMark 7   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax     Other Library Functions  
function  

utf16.writer

 
 

Library: Character encodings, UTF-16 (OMFFUTF16)
Import: omffutf16.xmd
Return type: output
Returns: 

A writable output target for streaming data.


Declaration

  export external output function writer
   bom value switch add-bom optional initial {true}
   big-endian value switch make-big-endian optional initial {true}
   into value output output-data


Purpose

Use writer to accept UTF-8 encoded data and write that data to a "value output", its first argument, converted from a UTF-8 encoding to a UTF-16 encoding. That is, the program writes UTF-8, but the provided output receives UTF-16.

writer has two further optional switch-valued arguments, placed ahead of the output argument. true is used as a default value in both cases. The two arguments are:

Any malformed output data is written as a Unicode NOT-A-CHARACTER character (0xFFFD). The only malformed cases recognized are characters too large to be encodable as UTF-16 (i.e. larger than 0xFFFF), and characters whose UTF-16 encodings would be the value of half of a surrogate pair.

Usage Note

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

  import "omffutf16.xmd" prefixed by utf16.

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

Example


  ; Copy the file named by the first command-line argument to
  ; the file named by the second command-line argument, converting
  ; from UTF-8 encoding (the default) to UTF-16 encoding on the
  ; output file.
  import "omffutf16.xmd" prefixed by utf16.
  process
     set utf16.writer into file #args [2] to file #args [1]

    Related Syntax
   utf16.writer
 
  Other Library Functions
   utf16.reader
   utf16.writer
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACYLIBRARIES ] [ ERRORS ]

OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:45:57 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.