没分了,求大神指点迷津,感激涕零!
Delphi2010 Tstringlist保存的字符串字母和数字显示为乱码,本人64位系统,联想笔记本。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
//*****************************************
procedure TForm1.Button1Click(Sender: TObject);
var
list:Tstringlist;
i,iT0,iT1 :Integer;
strT:string;
begin
list:=TStringList.Create;
list.Add('a');
list.Add('啊');
list.Add('B');
strT:=list[0]; //字符a
iT0:=Ord(strT); //字符'a'的asc码 ,正确应为97
iT1:=Ord('啊'); //字符'啊'的asc码
ShowMessage(list[0]); //显示字符'a'
ShowMessage(IntToStr( Length(list[0]))); //字符长度为 1
ShowMessage(IntToStr (iT0)); //字符'a'的asc码,显示出来为 71148588(不是97,且每次显示值都不一样);
ShowMessage(Chr(IT0)); //字符'a'的asc码反求字符,显示出来为 乱码'ꐬ'
end;
end.
//******************************