The OpenD Programming Language

transcode

Convert a string from one encoding to another.

Supersedes: This function supersedes std.utf.toUTF8(), std.utf.toUTF16() and std.utf.toUTF32() (but note that to!() supersedes it more conveniently).

void
transcode
(
Src
Dst
)
(
Src[] s
,
out Dst[] r
)

Parameters

s Src[]

Source string. Must be validly encoded. This is enforced by the function's in-contract.

r Dst[]

Destination string

Examples

wstring ws;
// transcode from UTF-8 to UTF-16
transcode("hello world",ws);
assert(ws == "hello world"w);

Latin1String ls;
// transcode from UTF-16 to ISO-8859-1
transcode(ws, ls);
assert(ls == "hello world");

See Also

Meta

Standards

Unicode 5.0, ASCII, ISO-8859-1, ISO-8859-2, WINDOWS-1250, WINDOWS-1251, WINDOWS-1252