to htw:
实际读数据的时候怎么写?现在DB中是UNICODE码,而要用ASCII的方式显示。我用下面的方法试过,
还是乱码:
var
str : widestring;
begin
str:=fieldbyname('coments').value;
showmessage(widechartostring(pwidechar(str)));
end;
function unicodetostr(const s: String): String;
var
i,len,j:Integer;
t:String;
begin
Result:='';
len:=Length(s);
i:=1;
while i<=len do begin
t:=Copy(s,i,4);
j:=StrToInt('$'+t);
t:=widechar(j);
Result:=Result+t;
i:=i+4;
end;
end;