I've scraped some data off a webpage. I used Web::Scraper to find the content of interest. The content scraped has UTF-8 data in it. For example, when it scrapes content with an apostrophe, it will return something: <p>What\x{2019}s up with the water ??</p>

This bit of data then gets stored into the database. The problem is that this results in the following getting stored into the db: <p>What’s up with the water ??</p>

The database table, schema, and columns are all UTF-8. I did $dbh->{mysql_enable_utf8} = 1 on the database handler. I tried the Encode module before inserting the data into the database but I couldn't get that to work. What do I need to do to the data before storing it into the database? UPDATE:

See comment in thread for what solved the problem.

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks


In reply to SOLVED: Storing UTF-8 data into database from scraped web page by nysus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.