Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 123455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T04:17:22+00:00 2026-05-11T04:17:22+00:00

I wish to download a web page, which may be in any possible text

  • 0

I wish to download a web page, which may be in any possible text encoding, and save it as UTF16LE. Assuming I can determine the text’s encoding (by examining the HTTP header, HTML header, and/or BOM), how do I convert the text?

I am using Delphi 2009. Unfortunately, the help files do not explain how to get from any encoding to a Unicode (UTF16LE) string. Specific questions:

  • Can I complete the conversion, simply by setting the correct encoding on an AnsiString and assigning that to a UnicodeString?
  • If so, how do I translate the various ‘charset’ descriptions that may label the web page (Big5, Shift-JIS, UTF-32, etc) into the right format to initialize the AnsiString?

Thanks for your suggestions.

I have a preference for straight Win32 and VCL, but answers involving ActiveX controls may also be helpful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T04:17:22+00:00Added an answer on May 11, 2026 at 4:17 am

    how are you going to access the page? Embedded Internet Explorer, INDY, third party tool, …? That might influence the answer because it determines the format of the input string.

    Part 1: Getting the page

    If you use the Embedded Internet Explorer (TWebBrowser) to access the page things are pretty straightforward:

    var htmlElement:IHTMLElement;     myText:String; begin   // Get access to the HTML element of the document:   htmlElement:=(WebBrowserControl.DefaultInterface.Document as IHTMLDocument3).documentElement;   // Receive the full HTML of the web page:   myText:=htmlElement.OuterHTML; 

    The encoding of the web page should be handled properly by the IE and by Delphi and you end up with a UnicodeString containing the result (myText in the examples).

    Part 2: Saving in UTF-16LE

    Regardless where your string came from – you can save it like this in the desired encoding:

    var s:TStringStream; begin   s:=TStringStream.Create(myText, TEncoding.Unicode, false);   s.SaveToFile('yourFileToSaveTo.txt');   FreeAndNil(s); end; 

    TEncoding.Unicode is UTF-16LE, but you could also use any other encoding.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wish to download information from the website http://revigo.irb.hr/ which have an interactive menu.
I wish to programmatically download a webpage which requires a log in to view.
Is there any C++ Library that can download data from internet when we provide
Suppose i wish to pause the download, and start it again. Can we know
I have a web app(jsp/servlets) which allows users to download audio files and play
I wish to add the mouseover events to a panel which contains more than
I wish to edit ini files over web server, decided to use django, been
I wish to write a windows app which does something when I become disconnected
I am trying to determine the best way to save an unknown string on
I wish to start using MS-Build. I have lots of projects which I build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.