代码:
string _content;
_content:=IdHTTP1.Get('www.aaa.com');问题:
可以正常访问简体网页,访问繁体网页时显示乱码,结果如下,请问如何解决返回结果:(片断)
<html>'#$A'<head>'#$A'<title>ì瞴跑计</title>'#$A'<meta http-equiv="Content-Type" content="text/html; charset=big5">'#$A'<script language="JavaScript">'#$A'<!--'#$A'if(self == top) location='http://www.s1188.com/app/member/''#$A'parent.username='ccha9977';'#$A'parent.maxcredit='1000';'#$A'parent.code='チ刽(RMB)';'#$A'parent.uid='6f8500e6m2161efl1a978';'#$A'parent.msg='穛叫猔種:05/19 (玭疭 VS 瓜緗)辽ㄆ87だ牧竬辟,埃初猔虫┮Τ猔虫.筁闽(1)璸衡!!.';'#$A'parent.ltype='3';'#$A'parent.str_even = '㎝Ы';'#$A'parent.str_submit = '絋粄';'#$A'parent.str_reset = '砞';'#$A'parent.langx='zh-tw';'#$A'parent.rtype='r';'#$A'parent.sel_lid='';'#$A'parent.retime=180;'#$A'parent.str_renew = '笆穝';'#$A'parent.game_more=1;'#$A'parent.str_more='贺猭';'#$A'parent.t_page=5.625;'#$A'parent.gamount=40;'#$A'
string _content;
_content:=IdHTTP1.Get('www.aaa.com');问题:
可以正常访问简体网页,访问繁体网页时显示乱码,结果如下,请问如何解决返回结果:(片断)
<html>'#$A'<head>'#$A'<title>ì瞴跑计</title>'#$A'<meta http-equiv="Content-Type" content="text/html; charset=big5">'#$A'<script language="JavaScript">'#$A'<!--'#$A'if(self == top) location='http://www.s1188.com/app/member/''#$A'parent.username='ccha9977';'#$A'parent.maxcredit='1000';'#$A'parent.code='チ刽(RMB)';'#$A'parent.uid='6f8500e6m2161efl1a978';'#$A'parent.msg='穛叫猔種:05/19 (玭疭 VS 瓜緗)辽ㄆ87だ牧竬辟,埃初猔虫┮Τ猔虫.筁闽(1)璸衡!!.';'#$A'parent.ltype='3';'#$A'parent.str_even = '㎝Ы';'#$A'parent.str_submit = '絋粄';'#$A'parent.str_reset = '砞';'#$A'parent.langx='zh-tw';'#$A'parent.rtype='r';'#$A'parent.sel_lid='';'#$A'parent.retime=180;'#$A'parent.str_renew = '笆穝';'#$A'parent.game_more=1;'#$A'parent.str_more='贺猭';'#$A'parent.t_page=5.625;'#$A'parent.gamount=40;'#$A'
解决方案 »
- 各位大虾delphi8怎么样?小弟在此恭候您的高见。
- 把BUF中的前recvValue个byte放到一个对应RECORD 类型的变量,请问怎么放?
- 服务器和路由器下的客户端SOCKET通讯
- dephi中,那个函数获取本机的ip地址,与本机的名称?是那个“uses”中的?谢谢
- 我想在程序中关闭已经打开的PowePoint,怎么办啊
- 用activexfrom开发的控件,打包成cab后在客户端注册不上是为何
- 在delphi中调用VC生成的DLL的问题:VC中的float, double, Integer,及函数指针在Delphi中各自对应什么?
- 如何在WIN2000读取打印机状态????UP有分啦……………………
- 简单:如何在两个过程之间传递一个控件名称。
- Delphi做的组件(DLL 或Exe)太大?怎么办?请指点
- wordApplication,quit时,提示是否保存。能不能不提示?因为不需要保存
- 一个小问题,关于拖放:如何没有选中某文本(比如只选中标题),将文本拖到别的应用程序中?
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);private
{ Private declarations }
public{ Public declarations }
end;var
Form1: TForm1;
function GBtoBIG5(value: string): string;
function BIG5toGB(value: string): string;implementation{$R *.DFM}
var
BIG5Order: array[0..14757] of Word;
GBOrder : array[0..8177] of Word;function GBOffset(value: string): integer;
begin
if length(value) >= 2 then
Result := (Ord(value[1]) - 161) * 94 + (Ord(value[2]) - 161)
else
Result := -1;
end;function BIG5Offset(value: string): integer;
begin
Result := -1;
if length(value) >= 2 then
begin
if (Ord(value[2]) >= 64) and (Ord(value[2]) <= 126) then
Result := (Ord(value[1]) - 161) * 157 + (Ord(value[2]) - 64);
if (Ord(value[2]) >= 161) and (Ord(value[2]) <= 254) then
Result := (Ord(value[1]) - 161) * 157 + 63 + (Ord(value[2]) - 161);
end
end;function WordToString(value: Word): string;
begin
Result := Chr(Hi(value)) + Chr(Lo(Value));
end;function isBIG5(value: string): Boolean;
begin
if (length(value)>=2) then
begin
if (value[1] < #161) then
Result := false
else
if ((value[2] >= #64) and (value[2] <= #126)) or ((value[2] >= #161) and (value[2] <= #254)) then
Result := true
else
Result := false
end
else
Result := false
end;function isGB(value: string): Boolean;
begin
if (length(value)>=2) then
begin
if (value[1] <= #161) and (value[1] >= #247) then
Result := false
else
if (value[2] <= #161) and (value[2] >= #254) then
Result := false
else
Result := true
end
else
Result := true;
end;function GBtoBIG5(value: string): string;
var
leng, idx : integer;
tmpStr : string[2];
Offset : integer;
output : string;
begin
output := '';
leng := length(value);
idx := 1;
while idx <= leng do
begin
tmpStr := value[idx]+ value[idx + 1];
if isGB(tmpStr) then
begin
offset:=GBOffset(tmpStr);
if (offset >= 0) and (offset <= 8177) then
begin
output := output + WordToString(GBOrder[offset]);
inc(idx);
end
else
output := output + value[idx] ;
end
else
output := output + value[idx] ;inc(idx, 1);
end;
Result := output;
end;function BIG5toGB(value: string): string;
var
leng, idx : integer;
tmpStr : string[2];
output : string;
offset : integer;
begin
output := '';
leng := length(value);
idx := 1;
while idx <= leng do
begin
tmpStr := value[idx]+ value[idx + 1];
if isBIG5(tmpStr) then
begin
offset:=BIG5Offset(tmpStr);
if (offset >= 0) and (offset <= 14757) then
begin
output := output + WordToString(BIG5Order[offset]);
inc(idx);
end
else
output := output + value[idx];
end
else
output := output + value[idx];inc(idx);
end;
Result := output;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
label1.caption:=big5togb(edit1.text);
end;end.