string string_to_utf8(string s) string string_to_utf8(string s, int extended)
Description
Converts a string into an UTF-8 compliant byte-stream.
Note
Throws an error if characters not valid in an UTF-8 stream are
encountered. Valid characters are in the ranges
0x00000000-0x0000d7ff and 0x0000e000-0x0010ffff.
If extended is 1 then characters outside the valid ranges are
accepted too and encoded using the same algorithm. Such encoded
characters are however not UTF-8 compliant.