Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: Bug : eval and accent

by jbert (Priest)
on Nov 16, 2007 at 12:56 UTC ( [id://651188]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Bug : eval and accent
in thread Bug : eval and accent

Hmm...are you sure the file in in utf8? E9 is latin1 for e-acute.

Can you dump the hex values and check? (or just try code below).

If your users are entering latin-1, then you could use the Encode module to shift the script to utf8.

#!/usr/bin/perl use strict; use warnings; use Encode; use utf8; my $code = <<"EOLATINCODE"; my \$var_with_\xE9_accent = 10; print \"var is \$var_with_\xE9_accent\\n\"; EOLATINCODE $code = decode('latin1', $code); print "CODE is $code\n"; eval $code; if ($@) { print "DIED: $@\n"; }
You don't seem to need 'use utf8' in the eval'd code in this case, but you seem to need it in the containing script.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (8)
As of 2024-04-24 09:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found