[Maypole] Unicode, CGI::Untaint, Class::DBI::FromCGI

Andrew Findlay andrew.findlay@skills-1st.co.uk
Thu, 6 May 2004 10:45:00 +0100


On Wed, May 05, 2004 at 11:03:53PM +0300, Gaal Yahas wrote:

> 1. I changed AddDefaultCharset from "On" to "utf-8"; this fixed the
>    symptom.
> 
> 2. It's not clear to me why the http-equiv doesn't override Apache's
>    defualt (which by rights should only be added to pages that don't
>    specify their encoding explicitly).

>From the Apache manual:

# AddDefaultCharset directive
# Syntax: AddDefaultCharset On|Off|charset
# Context: all
# Status: core
# Default: AddDefaultCharset Off
# Compatibility: AddDefaultCharset is only available in Apache 1.3.12 and later
# 
# This directive specifies the name of the character set that will be
# added to any response that does not have any parameter on the content
# type in the HTTP headers. This will override any character set
# specified in the body of the document via a META tag. A setting of
# AddDefaultCharset Off disables this functionality. AddDefaultCharset
# On enables Apache's internal default charset of iso-8859-1 as required
# by the directive. You can also specify an alternate charset to be
# used.

The key here is that the default will be added if no charset is
defined *in the HTTP headers*. The presence of a META tag in the
document has no effect.

It would be wise to make sure that a charset is specified either in
the headers or in the page template for all pages. Maypole does this
in the factory/header template.

Andrew
-- 
-----------------------------------------------------------------------
|                 From Andrew Findlay, Skills 1st Ltd                 |
| Consultant in large-scale systems, networks, and directory services |
|     http://www.skills-1st.co.uk/                +44 1628 782565     |
-----------------------------------------------------------------------