ultranerds has asked for the wisdom of the Perl Monks concerning the following question:
First of all, I've read perlunitut, and also the page linked to from it (regarding UTF8). From my understanding, what I gotta do is:
use Encode; my $data = decode('UTF-8', $IN->param("data"));
...process it here
$data = decode('UTF-8', $data);In my actual example script, I've used:
(my script is creating a hash, which is getting passed into a DB module). The output of the script seems ok - but for some reason its broken in phpMyAdmin :/map { $cat_add->{$_} = encode("UTF-8",$cat_add->{$_} ); } keys %$cat_add;
...and in phpmyadmin:Adding: Agricultura/Fumigación Aérea $VAR1 = { 'FatherID' => '75321', 'Full_Name_Flat' => 'agricultura/fumi +gacion aerea', 'Full_Name' => 'Agricultura/Fumigación Aérea', 'Name_E +nglish' => 'Aerial fumigation', 'Name' => 'Fumigación Aérea', 'CatDep +th' => '0' }; Done...
75321 Agricultura 0 0 0 Agricultura + 0 0 No No NULL 2012-09-04 03:11:10 + 0 Agriculture agricultura 75322 Fumigación Aérea 75321 75321 1 Agricultura +/Fumigación Aérea 0 0 No No + NULL 2012-09-04 03:11:10 0 Aerial fumigation + agricultura/fumigacion aerea
The annoying part is it works EVERYWHERE apart from phpmyadmin ... am I missing anything? I've been coding for a fair time now, and I've only just taken the time to really look into the best practices for utf8/unicode... makes a LOT more sense now - but for some reason this just doesn't seem to wanna play ball :/
TIA
Andy
|
|---|