
31.01.2010, 10:07
|
 |
Начинающий
|
|
Регистрация: 04.05.2009
Сообщения: 110
Репутация: 18
|
|
а почему бы и нет?
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
IdHTTP;
type
TForm1 = class(TForm)
IdHTTP1: TIdHTTP;
Edit1: TEdit;
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
stringshtml:widestring;
implementation
{$R *.dfm}
//function for translating "ieroglifs" to russian text
function RussianToUnicode(S: String): String;
var Wrd:Word;
pW,pR:PWord;
len:Integer;
begin
pW:=@S[1];
len:=Length(S);
SetLength(Result,len);
pR:=@Result[1];
while Len<>0 do begin
Wrd:=pW^;
case Wrd of
$C0..$DF,$E0..$FF:pR^:=Wrd+$0350;
else pR^:=Wrd;
end;
inc(pW);
inc(pR);
dec(Len);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
IdHttp1.HandleRedirects:=True;
stringshtml:=RussianToUnicode(idhttp1.Get(edit1.text));
memo1.text:=stringshtml;
end;
end.
Это показывает исходный код, а дальше парси (нормально видит русский и английский, остальные языки не пробовал).
|