bin:encode-string

Encodes a string into a binary value using a given encoding.

encode-string($value as xs:string?, $encoding as xs:string?:='UTF-8') ➔ xs:base64Binary?

Arguments

 

$value

xs:string?

Input binary data

 

$encoding

xs:string?

:= 'UTF-8'

The encoding type to be used

Result

xs:base64Binary?

Namespace

http://expath.org/ns/binary

Links to specifications

EXPath Binary Module 1.0

EXPath Binary Module 4.0

Saxon availability

Available in XPath 2.0 and later versions. Implemented since Saxon 9.6. Requires Saxon-PE or Saxon-EE. Available for all platforms.

Notes on the Saxon implementation

Supported encodings are: UTF-8, UTF-16, ISO-8859-1 and US-ASCII.