Pike v8.0 release 1738

Method utf8_to_string()


Method utf8_to_string

string utf8_to_string(string(8bit) s)
string utf8_to_string(string(8bit) s, int extended)

Description

Converts an UTF-8 byte-stream into a string.

Parameter s

String of UTF-8 encoded data to decode.

Parameter extended

Bitmask with extension options.

1

Accept and decode the extension used by string_to_utf8().

2

Accept and decode UTF-8 encoded UTF-16 (ie accept and decode valid surrogates).

Note

Throws an error if the stream is not a legal UTF-8 byte-stream.

Note

In conformance with RFC 3629 and Unicode 3.1 and later, non-shortest forms are not decoded. An error is thrown instead.

See also

Charset.encoder(), string_to_unicode(), string_to_utf8(), unicode_to_string()