Re: Http.get a page with unicode characters

Giganews Newsgroups
Subject: Re: Http.get a page with unicode characters
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Fri, 29 Apr 2005

"Costa" <costakaramalis@nospam.rogers.com> wrote in message
news:p3a5711o766kk2679ffge58sapg15bth…@4ax.com...

> I am trying to get a page that has unicode
> characters in it. (not the url, but the page body).

TIdHTTP has overloaded methods that allow you to download the data into a
TStream as-is rather than as an Ansi-encoded String.  For example:

    var
        strm: TMemoryStream;
    begin
        strm := TMemoryStream.Create;
        try
            http.Get(url, strm);
            // use strm as needed...
        finally
            strm.Free;
        end;
    end;

> I tried using
> var
> result:widestring
> begin
> result:=http.get(url);

That won't work since the data is still returned as a 'String' before then
being converted to your 'Widestring' variable.

Gambit

Replies

In response to

Http.get a page with unicode characters posted by Costa on Fri, 29 Apr 2005