Apache::Filter::HanConvert - Filter between Chinese variant and encodings
This document describes version 0.02 of Apache::Filter::HanConvert, released December 12, 2002.
In httpd.conf:
PerlModule Apache::Filter::HanConvert PerlOutputFilterHandler Apache::Filter::HanConvert PerlSetVar HanConvertFromVariant "traditional"
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).
Accept-Language
zh-cn
zh
zh-*
Accept-Charset
utf8
The Content-Type header will be rewritten to reflect the final encoding used.
Content-Type
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"
The HanConvertFromEncoding config probably could take multiple encodings and apply Encode::Guess to find out the correct source encoding.
HanConvertFromEncoding
Currently this module does not work with mod_dir, so the server's DirectoryIndex setting won't be honored. Patches welcome!
mod_dir
DirectoryIndex
Apache2, Encode::HanConvert, Encode
Autrijus Tang <autrijus@autrijus.org>
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
To install Apache::Filter::HanConvert, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache::Filter::HanConvert
CPAN shell
perl -MCPAN -e shell install Apache::Filter::HanConvert
For more information on module installation, please visit the detailed CPAN module installation guide.