perl-unicode

RE: Question about converting utf8 to ascii and char refs

2004-10-29 12:30:04
"Siladi, Aaron" <aaron(_at_)starwoodhotels(_dot_)com> wrote
Ok so that should work given the string has utf8 flag set.

What's the utf8 flag got to do with it?

Nick's program works for me without the utf8 flag set:

perl -w
use Encode;
my $s = "\x99 4";
use Devel::Peek;
Dump $s;
my $n = encode('ascii',$s,Encode::FB_HTMLCREF);
print "$n\n";
__END__
SV = PV(0x117c08) at 0x122968
  REFCNT = 1
  FLAGS = (PADBUSY,PADMY,POK,pPOK)      <==== look no UTF8
  PV = 0x117480 "\231 4"\0
  CUR = 3
  LEN = 4
&#153; 4


Mike Guy

<Prev in Thread] Current Thread [Next in Thread>