in reply to HTML Entities in CGI.pm Titles
use strict; use warnings; use HTML::Entities qw(decode_entities); use CGI; use Encode; my $title = decode_entities('xXxXxX™'); my $cgi = new CGI; print $cgi->header(-charset => 'utf-8'), $cgi->start_html(encode("utf-8",$title));
It prints out
Content-Type: text/html; charset=utf-8 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-U +S"> <head> <title>xXxXxX™</title>
Note that the following line is buggy, but I believe this is fixed in never CGI versions:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: HTML Entities in CGI.pm Titles
by 3dkiwi (Novice) on Nov 12, 2007 at 09:16 UTC |