pattern
Library: UTF-8 (OMUTF8)
Import : omutf8.xmd |
export switch function char overlong-handling value error-handling-type overlong-handling optional
The function utf8.char
matches UTF-8 encoded characters in its #current-input
. By default, or if the overlong-handling
variable is specified as not-allowed
, it matches only the shortest possible encoding, and overlong values are not matched. If the argument is specified as not-allowed-with-throw
, an overlong value will trigger a throw of the utf8.overlong-sequence
exception.
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