- or download this
my $to_entitise = q{<>&"'}; # Unsafe for HTML
my $decoded_text = decode('UTF-8', $utf8_text);
my $decoded_html = encode_entities($decoded_text, $to_entitise);
my $latin1_html = encode('iso-latin-1', $decoded_html, Encode::FB_HTML
+CREF);
- or download this
my $to_entitise =
q{<>&"'} . # Unsafe for HTML
...
my $decoded_text = decode('UTF-8', $utf8_text);
my $decoded_html = encode_entities($decoded_text, $to_entitise);
my $latin1_html = encode('iso-latin-1', $decoded_html);
- or download this
my $decoded_text = decode('UTF-8', $utf8_text);
my $decoded_html = encode_entities($decoded_text);
my $latin1_html = encode('iso-latin-1', $decoded_html);
- or download this
my $to_entitise = q{\x{100}-\x{1FFFFF}}; # Not present in iso-8859-1
my $decoded_html = decode('UTF-8', $utf8_html);
$decoded_html = encode_entities($decoded_html, $to_entitise);
my $latin1_html = encode('iso-latin-1', $decoded_html);
- or download this
use charnames qw( :full ); # For \N on older Perls
use Encode qw( encode decode );
...
my $utf8_text = encode('UTF-8', "a\N{U+00E9}\N{U+2660} 1<4");
my $utf8_html = encode('UTF-8', "a\N{U+00E9}\N{U+2660} <b>foo</b>");