(Gast)
n/a Beiträge
|
Re: "ANSI" zu "Unicode", zu "Big En
20. Mai 2005, 09:37
Delphi-Quellcode:
var
wBuf: PWideChar; // unicode
aBuf: PAnsiChar; // Ansi :)
sText: string;
begin
GetMem(wBuf, MAX_PATH);
GetMem(aBuf, MAX_PATH);
MultiByteToWideChar(CP_UTF8, 0, aBuf, MAX_PATH, wBuf, MAX_PATH); // ansi -> utf8
//...
sText := WideCharToString(wBuf); // utf8 -> string
//...
WideCharToMultiByte(CP_UTF8, 0, wBuf, MAX_PATH, aBuf, MAX_PATH, nil, nil); // utf8 -> ansi
FreeMem(wBuf, MAX_PATH);
FreeMem(aBuf, MAX_PATH);
end;
|
|
Zitat
|