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

  • Home
  • SEARCH
  • 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 6851743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:17:07+00:00 2026-05-27T01:17:07+00:00

I have a crawler that downloads webpages, scrapes specific content and then stores that

  • 0

I have a crawler that downloads webpages, scrapes specific content and then stores that content into a MySQL database. Later that content is displayed on a webpage when it’s searched for ( standard search engine type setup ).

The content is generally of two different encoding types… UTF-8 or ISO-8859-1 or it is not specified. My database tables use cp1252 west european ( latin1 ) encoding. Up until now, I’ve simply filtered all characters that are not alphanumeric, spaces or punctuation using a regular expression before storing the content to MySQL. For the most part, this has eliminated all character encoding problems, and content is displayed properly when recalled and outputted to HTML. Here is the code I use:

function clean_string( $string )
{

    $string = trim( $string );

    $string = preg_replace( '/[^a-zA-Z0-9\s\p{P}]/', '', $string );

    $string = $mysqli->real_escape_string( $string );

    return $string;

}

I now need to start capturing “special” characters like trademark, copyright, and registered symbols, and am having trouble. No matter what I try, I end up with weird characters when I redisplay the content in HTML.

From what I’ve read, it sounds like I should use UTF-8 for my database encoding. How do I ensure all my data is converted properly before storing it to the database? Remember that my original content comes from all over the web in various encoding formats. Are there other steps I’m overlooking that may be giving me problems?

  • 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-05-27T01:17:08+00:00Added an answer on May 27, 2026 at 1:17 am

    You should convert your database encoding to UTF-8.

    About the content: for every page you crawl, fetch the page’s encoding (from HTTP header/
    meta charset) and use that encoding to convert to utf-8 like this:

    $string = iconv("UTF-8", "THIS STRING'S ENCODING", $string);
    

    Where THIS STRING’S ENCODING is the one you just grabbed as described above.

    PHP manual on iconv: https://www.php.net/manual/en/function.iconv.php

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

Sidebar

Related Questions

I have a web crawler that looks for specific information I want and returns
I have a crawler application (with C#) that downloads pages from web . The
So, here's my question: I have a crawler that goes and downloads web pages
I have a simple web crawler that starts at root (given url) downloads the
I have implemented a web crawler that crawls and retrieves content from .edu TLD.
I have a web crawler that saves information to a database as it crawls
I am making a crawler that will put content(images) onto my website, i have
I have a crawler that for HTTPs switches over to Wininet. This usually works
We have a crawler that persistently crawls our target sites, it's log files are
In every paper I have read about crawler proposals, I see that one important

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.