convert ANSI to UTF-8
Oskar Linde
oskar.lindeREM at OVEgmail.com
Fri Jul 7 06:30:03 PDT 2006
gertje at gertje.org wrote:
> Hello,
>
> Does anybody have or know how to write a function to convert an ANSI string to a
> UTF-8 string? I am not using windows, so I cannot rely on the functions in
> std.windows.charset, since they use the MultiByteToWideChar function from the
> windows API...
I don't know what you mean by an ANSI string. An ascii string is a
subset of an utf-8 string so no conversion is neccessary. If your source
string is in the (in western countries) common ISO 8859-1 (aka latin-1)
the character values are a subset of the unicode code points and you can
convert directly using std.utf.encode. If the encoding is different, you
need to supply the mapping to unicode code points yourself (which
shouldn't be too hard).
/Oskar
More information about the Digitalmars-d
mailing list