MarkLogic 9 Product Documentation
xdmp:binary-decode

xdmp:binary-decode(
   $encoded as node(),
   $encoding-name as xs:string
) as xs:string

Summary

Converts an encoded byte sequence, passed in as a binary node, from the specified encoding to a unicode string.

Parameters
encoded A binary node containing the encoded stream.
encoding-name Specifies the encoding to use when decoding the document. Supported values include UTF-8 and ISO-8859-1. The string specifed for the encoding option will be matched to a registered encoding name using the Unicode Charset Alias Matching rules (http://www.unicode.org/reports/tr22/#Charset_Alias_Matching).

Example

xdmp:binary-decode(
   fn:doc("binary_doc_encoded_as_ShiftJIS.dat")/node(),
          "UTF-8")
=> contents of document after decoding, in unicode characters
Powered by MarkLogic Server | Terms of Use | Privacy Policy