Converts a string into an UTF16 compliant byte-stream.
Note
Throws an error if characters not legal in an UTF16 stream are
encountered. Valid characters are in the range 0x00000 - 0x10ffff,
except for characters 0xfffe and 0xffff.
Characters in range 0x010000 - 0x10ffff are encoded using surrogates.