For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > June 2006 > CGI and utf-8 output question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author CGI and utf-8 output question
Konstantin Rekk

2006-06-24, 7:56 am

Hello,

I am struggling to get utf-8 output to the browser,

this little snippet gives strange results:
(
perl -v

This is perl, v5.8.7 built for i586-linux-thread-multi
(with 1 registered patch, see perl -V for more detail)
)
------------------------------- utf_test.cgi ---------
#!/usr/bin/perl

use utf8;
use CGI qw(:all);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser) ;


$cgi=new CGI;

print "Content-type: text/html; charset=utf-8\n\n";

print "<html><head><title>Simple utf-8 test</title><meta http-equiv=
\"Content-Type\" content=\"text/html; charset=utf-8\"></head><body>Ü Ä
Ö</body></html>";

-------------------------------------------------

the source code of html-output in firefox:

<html><head><title>Simple utf-8 test</title><meta
http-equiv="Content-Type" content="text/html;
charset=utf-8"></head><body>� � �</body></html>

Cant figure out whats wrong.

Thanks, Konstantin




Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com