The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Apache::Filter::HanConvert - Filter between Chinese variant and encodings

VERSION

This document describes version 0.02 of Apache::Filter::HanConvert, released December 12, 2002.

SYNOPSIS

In httpd.conf:

    PerlModule Apache::Filter::HanConvert
    PerlOutputFilterHandler Apache::Filter::HanConvert
    PerlSetVar HanConvertFromVariant "traditional"

DESCRIPTION

This module utilizes the Encode::HanConvert module with Apache2's output filtering mechanism, to provide a flexible and customizable solution for serving multiple encoding/variants from the same source documents.

From the settings in "SYNOPSIS", the server would negotiate with the client's browser about their Accept-Language preference (zh-cn and zh means Simplified, other zh-* means Traditional), as well as the preferred Accept-Charset setting (defaults to utf8 if nothing was explicitly specified).

The Content-Type header will be rewritten to reflect the final encoding used.

If you want to use other encodings, try adding these lines:

    PerlSetVar HanConvertFromEncoding "UTF-8"
    PerlSetVar HanConvertToEncodingTraditional "big5"
    PerlSetVar HanConvertToEncodingSimplified "gbk"

Finally, if you'd like to dictate it to always convert to a specific variant/encoding, use this:

    PerlSetVar HanConvertToVariant "simplified"
    PerlSetVar HanConvertToEncoding "gbk"

CAVEATS

The HanConvertFromEncoding config probably could take multiple encodings and apply Encode::Guess to find out the correct source encoding.

Currently this module does not work with mod_dir, so the server's DirectoryIndex setting won't be honored. Patches welcome!

SEE ALSO

Apache2, Encode::HanConvert, Encode

AUTHORS

Autrijus Tang <autrijus@autrijus.org>

COPYRIGHT

Copyright 2002 by Autrijus Tang <autrijus@autrijus.org>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html