utf8.char

pattern

Library: UTF-8 (OMUTF8)
Import : omutf8.xmd

Declaration
export switch function 
   char overlong-handling value error-handling-type overlong-handling optional


Purpose

Use the function utf8.char to match UTF-8 encoded characters. By default, or if the overlong-handling is specified as utf8.not-allowed, it matches only the shortest possible encoding, and overlong values are not matched. If the argument is specified as utf8.not-allowed-with-throw, an overlong value will trigger a throw of the utf8.overlong-sequence exception.

Example

The following program converts a UTF-8 encoded file to a long character encoding (2 bytes for every character):

  import "omutf8.xmd" prefixed by utf8.
  
  process
     submit #main-input
  
  find utf8.char => char
     output "2f0b" % utf8.code-point of char

Usage Note

To use utf8.char, you must import OMUTF8 into your program using an import declaration such as:

  import "omutf8.xmd" prefixed by utf8.