safeEncodeFromUTF32

Encodes dstring to KOI8RString or KOI8UString. The input does not have to be valid.

AsciiBasedString
safeEncodeFromUTF32
(
AsciiBasedString
)
(
dstring s
)

Parameters

s dstring

The UTF32-string for transcoding.

Examples

dstring invalidText = "你好,世界!"d;
KOI8RString koi8rText = safeEncodeFromUTF32!KOI8RString(invalidText);
assert(cast(ubyte[])koi8rText == ['?', '?', '?', '?', '?', '?']);

Meta