Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Perl Character Set

by fizbin (Chaplain)
on Nov 02, 2005 at 03:11 UTC ( #504807=note: print w/replies, xml ) Need Help??

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, 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@/

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://504807]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2022-08-09 02:17 GMT
Find Nodes?
    Voting Booth?

    No recent polls found