Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re^3: Bug : eval and accent

by jbert (Priest)
on Nov 16, 2007 at 12:56 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2021-01-19 10:05 GMT
Find Nodes?
    Voting Booth?