var
  sm: tstringstream;
  str: string;
begin
  str := edt1.Text;
  sm := tstringstream.Create(str, TEncoding.GetEncoding('GB18030'));
  sm.SaveToFile('c:\test.txt');
  sm.Free;
end;




// gb18030 文件读取:无需特别处理
var
  str: string;
  sm, sd: TStringStream;
begin
  sm := TStringStream.Create;
  sm.LoadFromFile('c:\test.txt');
  str := sm.DataString;
  Memo2.Lines.Text := str;
  sm.Free;
end;

d2007 以下版本不支持

04-16 09:17