Utf8 in web perl application (LAMP) – binmode, charset

Wednesday 16 December 2009 @ 6:57 am

After wrestling with perl encoding, we need to make sure the pages of website we create are displayed in utf8.
This means we need to have proper header in pages, for example:

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>



</head>
<body>

and/or:

Content-Type: text/html; charset=utf-8

Second step, is to set binmode on STDOUT (if we print our dynamically generated webpages)

binmode STDOUT, “:utf8”;

to get rid of

Wide character in print at …

warnings.

Tags: ,

Comments (2) - Posted in work by  




Warning: Creating default object from empty value in /home3/lech/public_html/baczynski.com/perl/wp-includes/comment-template.php on line 1057

 2 responses to “Utf8 in web perl application (LAMP) – binmode, charset”

Leave a comment