in reply to Re^4: Help for "Cannot decode string with wide characters..." and CGI.pm
in thread Help for "Cannot decode string with wide characters..." and CGI.pm
But the value is not correctly displayed, just strange signs. Do you know what to do?
verify everything :)
all this encoding/decoding stuff just makes sure the bytes sent are proper, it doesn't ensure the HTML/HTTP is interpreted as utf
You say some browsers are not displaying what you want? Start with the browsers (page info, error console, view source .... ) then move on to http://validator.w3.org/unicorn/
For CGI.pm
$ perl -le " use CGI -utf8; my $q = CGI->new; print $q->header, $q->st +art_html " Content-Type: text/html; charset=ISO-8859-1 <!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>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +" /> </head> <body> $ perl -le " use CGI -utf8; my $q = CGI->new; print $q->header(qw/ -ch +arset UTF-8 / ), $q->start_html " 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>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body>
See also Tutorials: perlunitut: Unicode in Perl, perluniintro, Perl Unicode Essentials
|
|---|