[SP-pm] Problemas com Hexadecimal
Otávio Fernandes
otaviof at gmail.com
Thu Aug 14 16:32:52 PDT 2008
Senhores,
Estou com algumas dúvidas sobre decodificação hexadecimal. Vejam:
1 #!/usr/bin/env perl
2
3 use strict;
4 use warnings;
5
6 use Encode;
7
8 open( my $BODY,
9 '/home2/otavio.fernandes/users/teste/cur/1217853567.20253.shike,S=34403:2,S'
10 ) or die $!;
11
12 while (<$BODY>) {
13 chomp;
14 if (/forwarding the table/) {
15 print "Debug -> antes #", $_, "#\n";
16 s/&#([0-9a-f]+);/chr(hex($1))/ige;
17 print "Debug -> encode #", encode( "utf8", $_ ), "#\n";
18 print "Debug -> depois #", $_, "#\n";
19 }
20 }
21
22 close($BODY);
23
24 __END__
E o resultado é:
Debug -> antes #prohibited. However I’m forwarding the table
that’s contents =#
Debug -> encode #prohibited. However Ièm forwarding the table thatès contents =#
Wide character in print at decode_qp.pl line 18, <$BODY> line 844.
Debug -> depois #prohibited. However Ièm forwarding the table thatès contents =#
Como eu faço para que os caracteres sejam decodificados para UTF8?
Ainda não consegui perceber onde eu estou errando.
um abraço,
--
| --
| Otávio Fernandes <otaviof at gmail dot com>
| --
More information about the SaoPaulo-pm
mailing list