Sec has asked for the wisdom of the Perl Monks concerning the following question:
This seems overly ugly, just to get perl to do the right thing.use charnames ':full'; use open ':locale'; use Encode; for (PerlIO::get_layers(STDOUT)){ if (/encoding\((.*)\)/ || /(utf8)/ ){ $lc||=$1; } } print "Locale is: $lc\n"; $_="@ARGV"; $_=decode($lc,$_); $_=~s<([^\x{000a}\x{0020}-\x{007e}])>{ '\N{'.charnames::viacode(ord $1).'}' }ge; print $_,"\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: unicode DWIM?
by dragonchild (Archbishop) on Feb 24, 2005 at 13:56 UTC | |
Re: unicode DWIM?
by penguinfuz (Pilgrim) on Feb 24, 2005 at 13:35 UTC | |
Re: unicode DWIM?
by tphyahoo (Vicar) on Feb 24, 2005 at 10:42 UTC | |
by Sec (Monk) on Feb 24, 2005 at 11:13 UTC | |
by Anonymous Monk on Mar 05, 2006 at 14:25 UTC | |
Re: unicode DWIM?
by dakkar (Hermit) on Feb 24, 2005 at 13:29 UTC |