Every part of the handling must be correct; in and out. Scraper is probably doing the right thing, returning utf-8 decoded strings into your Perl. Your DB level is the most likely problem. You can try to enable UTF-8 handling but is the table or the table.column using that charset? If it's not, you're maybe stuffing binary UTF-8 into Latin-1. Look at the table in question; pull the LIMIT here or put in a WHERE

mysql> SELECT SCHEMA_NAME, DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATI +ON_NAME FROM information_schema.SCHEMATA limit 1; +--------------------+----------------------------+------------------- +-----+ | SCHEMA_NAME | DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_ +NAME | +--------------------+----------------------------+------------------- +-----+ | information_schema | utf8 | utf8_general_ci + | +--------------------+----------------------------+------------------- +-----+

If you get latin1 and latin1_swedish_ci (one of mysql's many awful defaults) then you should update the table, the column, or both to CHARACTER SET utf8 COLLATE utf8_general_ci. This is potentially dangerous for data there so backup your DB first.

Update: s/encoded utf-8/decoded utf-8/ to maintain pedantic semantics which are ultimately less confusing.


In reply to Re: Storing UTF-8 data into database from scraped web page by Your Mother
in thread 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.