http://qs321.pair.com?node_id=504807


in reply to Perl Character Set

Let me guess what the translation is:
À ->└ Lower right box corner
Á ->┴ Middle box bottom
 ->┬ Middle box top
à->├ Left middle box side
Ä ->─ Center box bar horizontal
This is exactly the translation you would expect if the database is being filled with data in iso-latin-1 and the program extracting it is interpreting data in cp437. My guess is that you're looking at the database with the command-line mysql tool running inside a windows cmd window. (On a US version of windows)

Here's the truth: You're going to have to deal with character encodings; you can't just close your eyes and ignore them. So here's the short version, so that you have to deal with as little as possible:

The windows cmd window doesn't display things in iso-latin-1. Instead, it uses an old DOS character set that is compatible with iso-latin-1 essentially only for ascii. In short, perl's doing everything fine, but the dos box displays characters in its own special non-standard way. To see that this issue is the dos box, and not your script, at the cmd window say: type myscript.pl, where script contains iso-latin-1 characters.

To "fix" this problem, at the C:\> prompt, type chcp 850. Then re-run the command-line tool you have to investigate the database.

Update: Never mind; code page 850 alone isn't enough to get the DOS box to display things in iso-latin-1. This might work after saying chcp 850, assuming that your perl is version 5.8 or better:

C:\>mydatabaseexamcommand | perl -MEncode=from_to -pe "from_to($_,q[la +tin1],q[cp850])"
Another option is to run your database command and redirect everything into a file. Then open that file with notepad or wordpad or whatever your favorite Windows editor is. Yet another option is to examine the database with mysql's own graphical "mysql browser" tool.

--
@/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/; map{y/X_/\n /;print}map{pop@$_}@/for@/