🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Help: HTTP and Unicode web pages

#1739
From: Stefano Bonifazi
Date: Tue, 07 Nov 2006 09:18
35 lines
2158 bytes
Hi all! :)
  I need to download web pages that contain Unicode text!
I thought to use Indy HTTP component as Indy is known as the best 
Internet suite for BCB... I use version 9, the latest I think for BCB6.
In my early tests I wish only to show the downloaded page in a TntMemo 
component (Tnt components are capable of handling Unicode text).
I firstly tried to use simply the return of the Get(AnsiString URL) 
function ... but in the Memo appaired strange characters other than 
those in my web page (a cyrillic page).
Mr Lebeau told me to use the overloaded function and put all in raw 
stream! I used TTntMemoryStream

  TTntMemoryStream* pstream=new TTntMemoryStream;
  IdHTTP1->Get("http://someRussianwebpage.htm",(TStream*)pstream);

  then if I write that stream on file

pstream->SaveToFile("c:\\prova.htm");

in that page there are again those different characters something like:

����� ��������� ��������� ������� ������ ��������

if use TntMemo1->Lines->LoadFromStream(pstream); nothing is shown

if i load in a WideString this way
WideString ws=WideString((char*)pstream->Memory);
TntMemo1->Text=ws;

the same ugly characters are showed :(

Is there anyone who can help me?

Thank U very much in advance!
Stefano B
Technical Details
Message-ID: <45504f4b@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,b86c04237df4f2b2,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII
Date: Tue, 07 Nov 2006 10:18:10 +0100
From: Stefano Bonifazi <stefboombastic@email.it>
User-Agent: Thunderbird 1.5.0.7 (Windows/20060909)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Help:  HTTP and Unicode web pages 
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: 80.104.236.7
Message-ID: <45504f4b@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1162891083 80.104.236.7 (7 Nov 2006 01:18:03 -0700)
Lines: 35
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail