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 8805107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:46:43+00:00 2026-06-14T01:46:43+00:00

I just want to know if its possible to extract content encoded (in utf-8)

  • 0

I just want to know if its possible to extract content encoded (in utf-8) from a html file without encoding header.

My specific case is this website:

http://www.metal-archives.com/band/discography/id/203/tab/all

I want to extract all the info but, as you can see, this word for example, looks bad:

Motörhead

I tried to use file_get_html, htmlentities, utf_decode, utf_encode and mix of them with different options but I cant find a solution…

Edit:

I just want to see the same website with correct format with this simple code:

$html_discos = file_get_html("http://www.metal-archives.com/band/discography/id/223/tab/all");
//some transform/decode here
print_r($html_discos);

I want the content in correct format in a string or DOM object to get some parts later.

Edit 2:

$file_get_html is a function of “simple html dom” library:

http://simplehtmldom.sourceforge.net/

That have this code:

function file_get_html($url, $use_include_path = false, $context=null, $offset = -1, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
{
    // We DO force the tags to be terminated.
    $dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText);
    // For sourceforge users: uncomment the next line and comment the retreive_url_contents line 2 lines down if it is not already done.
    $contents = file_get_contents($url, $use_include_path, $context, $offset);
    // Paperg - use our own mechanism for getting the contents as we want to control the timeout.
    //$contents = retrieve_url_contents($url);
    if (empty($contents) || strlen($contents) > MAX_FILE_SIZE)
    {
        return false;
    }
    // The second parameter can force the selectors to all be lowercase.
    $dom->load($contents, $lowercase, $stripRN);
    return $dom;
}
  • 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. Editorial Team
    Editorial Team
    2026-06-14T01:46:44+00:00Added an answer on June 14, 2026 at 1:46 am

    The Content-Type of the URL

    http://www.metal-archives.com/band/discography/id/203/tab/all
    

    is:

    Content-Type: text/html
    

    This will default to ISO-8859-1. But instead you want to use UTF-8. Change the Content-Type so this is correctly signaled:

    Content-Type: text/html; charset=utf-8
    

    See: Setting the HTTP charset parameter

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

Sidebar

Related Questions

I'm new to regex and just want to know if its possible to find
Basically, I just want to know if its possible to use Nhibernate to migrate
I don't know if its possible but just want to ask if we can
I don't know either its possible to decrypt a shadow file or not. Just
I have a query and I just want to know if its possible to
Just want to know how to read an attribute of a parent node from
I just want to know if it is possible in Java to create a
Greetings everyone! I want to know if its possible to find out if a
I just want to know if it is possible to check if an attribute/property
I'm just curious. Maybe for a future project. I want to know if it's

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.