HTML y UTF8 encoding
Ejemplo de utf8 encoding:#This is perl 5, version 14, subversion 2 (v5.14.2)
#File: ExampleEncoder.pm
package ExampleEncoder;
use Moose;
use strict;
use warnings;
#use namespace::autoclean;
use HTML::Entities;
use Encode::Encoder;
sub encodeHTMLtoUTF8{
my ($self, $parametro) = @_;
my $s = HTML::Entities::decode($parametro);
$s = Encode::Encoder::encoder($s)->utf8;
return $s;
}
no Moose;
__PACKAGE__->meta->make_immutable; #no voy a cambiar mi clase
1;
#!/usr/bin/perl
#use strict;
use warnings;
use ExampleEncoder;
my $ex = Example->new();
my $str = "Córdoba";
print $ex->encodeHTMLtoUTF8($str);
No hay comentarios:
Publicar un comentario