I am trying to get Apache, Perl, HTML5 and UTF-8 to all work together in a web page.I'm just doing it wrong.
What is happening is I can see the HTML5 source code and the browser chrome thinks the encoding is utf-8.
At this point I can not tell if its the server that could need an update or Also the Content-Length $byte_count never comes out correct.
The test code.
Update: I got it to work. Viewing the source problem was the header text/plain, I needed text/html. The "Content-Length" issues was
the fact I was on windows.
Its still so new to me I have a feeling there is something not right...#!perl my $smiley = chr(0x263a); #"\x{263a}" my $rendered = <<HTML; <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Title of the document</title> </head> <body> <p>Test HTML my $rendered2 = <<HTML; </p> </body> </html> HTML # embed a Unicode character :) $rendered .= $smiley; # render footer $rendered .= $rendered2; use Encode qw{encode}; # [id://1164454] binmode STDOUT, ":raw"; $rendered = encode(utf8 =>$rendered); my $byte_count = length($rendered); print <<HTML; Content-Length: $byte_count Content-Type: text/html; charset=utf-8 HTML print $rendered; exit;
In reply to Perl UTF-8 serving HTML5 by $h4X4_|=73}{
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |