type wie = (AsciiToAnsi, AnsiToAscii);
function wandlung(quelle: string; art: wie): string;
begin
SetLength(Result, Length(quelle));
if Length(Result) > 0 then
if art = AsciiToAnsi
then OemToChar(Pchar(quelle), Pchar(Result))
else
CharToOem(Pchar(quelle), Pchar(Result))
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
showmessage(wandlung('Ž™š„”á', AsciiToAnsi));
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
showmessage(wandlung('ÄÖÜäöüß', AnsiToAscii));
end;