Just another Perl shrine | |
PerlMonks |
Mess with UTF-8, utf8 and raw encoding on live working platformby AlfaProject (Beadle) |
on Jun 02, 2011 at 08:50 UTC ( [id://907768]=perlquestion: print w/replies, xml ) | Need Help?? |
AlfaProject has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks :) I have a problems with encoding on my web platform. This app using flat files for database. When I started to develop , I used this code to open files: open FH,">$path"; after few weeks we started to get traffic from other countries and names on other languages. I get broken chars with existing code , and changed it to this only on inputs(>) open FH , ">:utf8",$file_path; it worked like that few months The most traffic we get is from 'facebook login' button that uses perl api to get the data. I recognized that on post forms, perl gets another data with broken chars I already spent a few days on reading articles about encodings in perl and I still don't get the point how to work with that in the right way For now I have changed all the inputs and output filehandles to this,because I read that it's the strict UTF in this article http://perlgeek.de/en/article/encodings-and-unicode open FH, "<:encoding(UTF-8)", "$dir/private_data"; After that I get problems on posts and data that come from facebook, after many tries I got a code that works well. But the problem , that I doesn't understand why it works .. here is the code
Now I see that old database that writen in regular way and old utf8 get a broken chars. When I doing cat private_datawith the new :encoding(UTF-8) in putty i get also not right encoding that looks like that|||�и�о�лава|Ханева|female|03-08-1982| I feel that I'm like in circle of searchings that will never end Don't really know what to ask, just need a help with this. Thanks a lot !!!
Back to
Seekers of Perl Wisdom
|
|