emilioayllon has asked for the wisdom of the Perl Monks concerning the following question:
After a whole afternoon trying to find out the problem I seek the wisdom of PerlMonks.
I've got a unicode file where, after processing, some lines will go into a Mysql (4.0.14) DB.
Using perl 5.8.0 I specified that the file is in utf8 by:
A little bit of processing later the script prints on console the data I want to insert into the DB and all foreign characters seem to be fine.$txt_opener = new IO::File;<br> open( $txt_opener,'<:utf8', "$filetxt");
Once this goes into the DB using a standard SQL command and perl DBI driver the query executes fine.
However, using the console and/or phpmyadmin I interrogate the database and foreign characters ie. ñ, í are corrupted.
when the table is created the character set is specified "CHARACTER SET utf8".
Finally, if in this very same script I set a variable to a fix string with foreign characters ie. $var='ñíó' and execute using the same procedure the whole thing works fine.
So, the question is why if the variable gets assigned to a fixed string the thing works but if it comes from a dynamic assignment it fails to insert the data correctly.
I guess the problem is more related to perl than to mysql but sorry to ask in the wrong forum if this is not the case
Many thanks for your help!
Emilio.
Edit, BazB: added code tags.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Mysql and UTF8
by etcshadow (Priest) on Nov 02, 2003 at 02:07 UTC | |
by emilioayllon (Novice) on Nov 02, 2003 at 03:29 UTC | |
by etcshadow (Priest) on Nov 02, 2003 at 05:18 UTC | |
|
Re: Perl Mysql and UTF8
by graff (Chancellor) on Nov 02, 2003 at 15:17 UTC |