View source code
Display the source code in std/encoding.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Function std.encoding.encodingName

Returns the name of an encoding.

string encodingName(T)() @property;

The type of encoding cannot be deduced. Therefore, it is necessary to explicitly specify the encoding type.


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


writeln(encodingName!(char)); // "UTF-8"
writeln(encodingName!(wchar)); // "UTF-16"
writeln(encodingName!(dchar)); // "UTF-32"
writeln(encodingName!(AsciiChar)); // "ASCII"
writeln(encodingName!(Latin1Char)); // "ISO-8859-1"
writeln(encodingName!(Latin2Char)); // "ISO-8859-2"
writeln(encodingName!(Windows1250Char)); // "windows-1250"
writeln(encodingName!(Windows1251Char)); // "windows-1251"
writeln(encodingName!(Windows1252Char)); // "windows-1252"


Janice Caron


Boost License 1.0.