🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #1748

Re: Help: HTTP and Unicode web pages

#1748
From: Hans Galema
Date: Tue, 07 Nov 2006 14:01
35 lines
2411 bytes
Stefano Bonifazi wrote:
> Ok I post that in the attachments group

 >  TTntMemoryStream* pstream=new TTntMemoryStream;
 >  IdHTTP1->Get("http://scream3.film.ru/story.htm",(TStream*)pstream);
 >  WideString ws=WideString((char*)pstream->Memory);
 >  pstream->SaveToFile("c:\\Test.html");
 >  TntMemo1->Text=ws;
 >  delete pstream;

So you meant:

   TTntMemoryStream* pstream=new TTntMemoryStream;
   IdHTTP1->Get("http://scream3.film.ru/story.htm",(TStream*)pstream);
   pstream->SaveToFile("c:\\Test.html");
   delete pstream;

The attached page has nearly the same size as when saved with Firefox.
Also here the text in cyrillic are characters in 8bit. (Cyrillic: Windows 1251).

What is the reason that you use TTntMemoryStream? You could as well
use TMemoryStream I think.

   TMemoryStream* pstream=new TMemoryStream;
   IdHTTP1->Get("http://scream3.film.ru/story.htm",(TStream*)pstream);
   pstream->SaveToFile("c:\\Test.html");
   delete pstream;

Just converting 8bit to Widestring will not do I think to display all normal.
During the conversion from 8 to 16 bit you should tell the converter that
-some- character encoding is 8bit cyrillic.

Sory. I'm not familiar with that.

Hans.
Technical Details
Message-ID: <455091f7$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <45504f4b@newsgroups.borland.com> <45506156@newsgroups.borland.com> <45506982@newsgroups.borland.com> <45506f59$1@newsgroups.borland.com> <455074f4@newsgroups.borland.com> <455078f1$1@newsgroups.borland.com> <455081bb@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,b86c04237df4f2b2
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 07 Nov 2006 15:01:02 +0100
From: Hans Galema <notused@notused.nl>
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Re: Help:  HTTP and Unicode web pages 
References: <45504f4b@newsgroups.borland.com> <45506156@newsgroups.borland.com> <45506982@newsgroups.borland.com> <45506f59$1@newsgroups.borland.com> <455074f4@newsgroups.borland.com> <455078f1$1@newsgroups.borland.com> <455081bb@newsgroups.borland.com>
In-Reply-To: <455081bb@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 145.98.201.248
Message-ID: <455091f7$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1162908151 145.98.201.248 (7 Nov 2006 06:02:31 -0700)
Lines: 35
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail