tango.sys.win32.CodePage

License:

BSD style: see license.txt

Version:

Initial release: April 2007

Author:

Kris
struct CodePage
Convert text to and from Windows 'code pages'. This is non-portable, and will be unlikely to operate even across all Windows platforms.
bool isAscii(const(char)[] src) [static]
Test a text array to see if it contains non-ascii elements. Returns true if ascii, false otherwise
char[] into(const(char)[] src, char[] dst, uint page = 0) [static]
Convert utf8 text to a codepage representation
page 0 - the ansi code page 1 - the oem code page 2 - the mac code page 3 - ansi code page for the calling thread 65000 - UTF-7 translation 65001 - UTF-8 translation

or a region-specific codepage

Returns:

a slice of the provided output buffer representing converted text

Note that the input must be utf8 encoded. Note also that the dst output should be sufficiently large to accomodate the output; a size of 2*src.length would be enough to host almost any conversion
char[] from(const(char)[] src, char[] dst, uint page = 0) [static]
Convert codepage text to a utf8 representation
page 0 - the ansi code page 1 - the oem code page 2 - the mac code page 3 - ansi code page for the calling thread 65000 - UTF-7 translation 65001 - UTF-8 translation

or a region-specific codepage

Returns:

a slice of the provided output buffer representing converted text

Note that the input will be utf8 encoded. Note also that the dst output should be sufficiently large to accomodate the output; a size of 2*src.length would be enough to host almost any conversion