in reply to Re: Storing UTF-8 data into database from scraped web page
in thread SOLVED: Storing UTF-8 data into database from scraped web page

Yeah, I tried that. It just makes things even uglier. Output from mysql looks like this: <p><p>Whatâ  s up with the water ??</p>

Output when I dump the scraped content looks like this: <p>Whatâ~@~Ys up with the water ??</p>

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

Replies are listed 'Best First'.
Re^3: Storing UTF-8 data into database from scraped web page
by thanos1983 (Parson) on Jun 14, 2018 at 20:58 UTC

    Hello again nysus,

    I just tried that on my local DB and it works. I found the module Text::Unidecode it should do what you need.

    #!/usr/bin/perl use utf8; use strict; use warnings; use Text::Unidecode; my $encode = unidecode("What\x{2019}s up with the water ??"); print $encode . "\n"; __END__ $ perl test.pl What's up with the water ??

    Update: Not to forget you need to define also the column in your table as:

    `Column` VARCHAR(150) CHARACTER SET utf8 NOT NULL UNIQUE,

    You do not the parameter NULL UNIQUE I just usually add them on my columns so I will avoid duplications etc.

    Update2: Sample of the whole code that I tested:

    The conf.ini file:

    Hope this helps, BR.

    Seeking for Perl wisdom...on the process of learning...not there...yet!