Could Encode work on it?
use Encode;
$new = encode("iso-8859-1",decode("iso-8859-8",$str));
Regards.
This seems to work:
#!/usr/bin/perl
use strict;
use warnings;
use encoding( 'utf8' );
use HTML::Entities;
my $str = "“ test ” ניסיון ";
$str = decode_entities( $str );
print "$str\n";
__END__
--
Just my 0.00000002 million dollars worth,
Shawn
Confusion is the first step of understanding.
Programming is as much about organization and communication
as it is about coding.
The secret to great software: Fail early & often.
Eliminate software piracy: use only FLOSS.
>2011/2/2 Shlomit Afgin <Shlomi...@weizmann.ac.il>:
>
>
> > I tried to convert html special characters to their real character.
> > For example, converting ” to " .
> >
> > I had the string
> > $str = "“ test ” ÈÒÈÂÔ†¢ª
> > The string contain also Hebrew letters.
>
>Could Encode work on it?
use Encode;
$new = encode("iso-8859-1",decode("iso-8859-8",$str));
Heaven forbid!
The html entities are Unicode decimal, so all you need to do in this
case is get the number n and then execute chr n in a substitution:
#!/usr/local/bin/perl
use strict;
binmode STDOUT, 'utf8';
$_ = "“א”";
s~&#([\d]+);~chr $1~eg;
print; # -=> “א”
JD