Jump to content

Rebol Programming/utf?

From Wikibooks, open books for an open world

USAGE:

[edit | edit source]
UTF? data 

DESCRIPTION:

[edit | edit source]

Returns the UTF encoding from the BOM (byte order marker): + for BE; - for LE.

UTF? is a function value.

ARGUMENTS

[edit | edit source]
  • data -- (Type: binary)

SOURCE CODE

[edit | edit source]
utf?: func [
    {Returns the UTF encoding from the BOM (byte order marker): + for BE; - for LE.} 
    data [binary!]
][
    parse/all/case data [
        #{EFBBBF} (return 8) | 
        #{0000FEFF} (return 32) | 
        #{FFFE0000} (return -32) | 
        #{FEFF} (return 16) | 
        #{FFFE} (return -16) | 
        (return 0)
    ]
]