Wednesday 16 December 2009 @ 6:57 am
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
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.
See also:
- Utf8 in web perl application (LAMP) – dbi, mysql
- Utf8 in web perl application (LAMP)
- Utf8 in web perl application (LAMP) – part 2 – Encode
- Utf8 horror at LAMP – accept charset
- Perl WTFs – last in function


Not “and/or”. Definitely “and”. The correct Content-Type is a MUST. On the other hand, the meta element can be left out. – Avoid the transitional document types for new documents! As the name says, it is for transitioning up from HTML 3 or untyped HTML. When generating documents, you are completely under control. Use the strict document type.
> Use the strict document type.
And what benefit will this give to me?