However in the resulting files, the characters are in the windoze charset. On the advice of a post somewhere else, I tried adding binmode(OUT,":utf8"); after the file open, no help. I also tried wrapping the encode statements in encode_entities from HTML::Entities. Also no help. How do I get these chars to output properly?Use Encode; . . . open(OUT,">topurls.htm") or die "Can't open output: $!"; print OUT <<'END_HEADER'; <html> <head> <title>Top URLs</title> <meta http-equiv="Content-Type" content="text/html; ch +arset=utf-8"> </head> <body> <h3>Top URLs</h3> <table cellpadding=10 border=1><tr><th>Link</th><th>Co +unt</th><th>Users</th></tr> END_HEADER foreach my $u (keys %topurls) { my @line; $line[0] = '<a target="_blank" href="'.encode('UTF-8',$u).'">'.enc +ode('UTF-8',$topurls{$u}{title}).'</a>'; $line[1] = $topurls{$u}{count}; $line[2] = $topurls{$u}{users}; print OUT '<tr><td>'.join('</td><td>',@line).'</td></tr>'."\n"; } print OUT '</table></body></html>'; close OUT;
In reply to Writing HTML file with UTF-8 chars by cormanaz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |