in reply to Re^2: Bug : eval and accent
in thread Bug : eval and accent
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.
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.#!/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"; }
|
|---|