utfConvert

Converts any type of Unicode/UTF string with or without a BOM (UTF-8, UTF-16, UTF-32, big or little endian), strips the BOM (if it exists), and automatically converts it to native endianness and whatever string type is specified in TOut.

If there is no BOM, then UTF-8 is assumed.

TOut
utfConvert
(
TOut
TInChar
)
(
immutable(TInChar)[] data
)
if (
isSomeString!TOut &&
(
isSomeString!(immutable(TInChar)[]) ||
is(TInChar == ubyte)
)
)

Examples

string utf8 = utfConvert!string ( anyUTFDataWithBOM ); wstring utf16 = utfConvert!wstring( anyUTFDataWithBOM ); dstring utf32 = utfConvert!dstring( anyUTFDataWithBOM );

Meta