Re: Converting WideChar/WideString to AnsiChar/AnsiString



ckoegl wrote:

Hi,

I cannot find anything definitive in the Delphi docs and in the
relevant newsgroups that answers this simple question:

What is the exact definition of the WideChar to AnsiChar conversion
(and in extension of the WideString to AnsiString conversion)?

The RTL basically uses this:

function CharFromWChar(CharDest: PChar; DestBytes: Integer; const
WCharSource: PWideChar; SrcChars: Integer): Integer;
begin
Result := WideCharToMultiByte(DefaultSystemCodePage, 0,
WCharSource, SrcChars,
CharDest, DestBytes, nil, nil);
end;


--
Rudy Velthuis http://rvelthuis.de

"Beware of bugs in the above code; I have only proven it correct,
not tried it." -- Donald E. Knuth.
.