Привет,
ftp://ftp.lexa.ru/pub/apache-rus/Apache-Charset-0.11.tar.gz
В комплекте есть тестовый cgi-скрипт, который позволяет понять
как этим пользоваться.
Manpage:
NAME
Apache::Charset - mod_perl interface to Russian Apache internals
SYNOPSIS
use Apache::Charset;
print "Known charsets: ".join(" ",$r->charsets())."<br>\n";
print "Server charset: ".$r->server_charset()."<br>\n";
print "Client charset: ".$r->client_charset()."<br>\n";
$str="some string";
$str_1251 = $r->recode($r->server_charset(),"windows-1251",$str);
$esc="%AA%BB%CC%DD%EE%FF";
$esc_1251=$r->recode_esc($r->server_charset(),"windows-1251",$esc);
DESCRIPTION
Apache::Charset provides interface to Russian Apache functions. This
module should be called after fixup stage of apache handlers (i.e. one
should use Apache::Charset in Apache::Registry scripts or in PerlHandler
routines).
MEMBER FUNCTIONS
$recoder = new Apache::Charset();
Creates new Apache::Charset object with internal request_rec record
set to current request.
$recoder->set_request($r);
Sets internal request_rec reference to $r. $r should be an object
returned by Apache->request call.
$recoder->is_ok;
Returns 1 if Russian Apache module has successfully processed
current request and undef overwise (f.e. mod_charset is disabled, or
some recoding tables was not found etc)
$server_charset=$recoder->server_charset;
Returns canonical name of server (or "source") charset. Returned
value is equivalent to $ENV{SOURCE_CHARSET}. Will return undef if
$recoder is not ok.
$client_charset=$recoder->client_charset;
Returns canonical name of client charset. Returned value is
equivalent to $ENV{CHARSET}. Will return undef if $recoder is not
ok.
@charsets=$recoder->charsets();
Returns list of charsets known by server (i.e. configured by
CharsetRecodeTable directives).
$str=$recoder->server2client($old_string);
$str=$recoder->server2client_esc($old_string);
Returns string converted from server charset to client charset.
server2_client_esc recodes %AA-escapes.
$str=$recoder->client2server($old_string);
$str=$recoder->client2server_esc($old_string);
Returns string converted from client charset to server charset.
server2_client_esc recodes %AA-escapes.
$str=$recoder->recode($from,$to,$string);
$str=$recoder->recode_esc($from,$to,$string);
Generic recoder interface. Recodes $string from $from charset into
$to charset
BUGS
SEE ALSO
the mod_perl(3) manpage, the Apache(3) manpage
AUTHOR
Alex Tutubalin <lexa@lexa.ru>
Alex
"Russian Apache" includes software developed
by the Apache Group for use in the Apache HTTP server project
(http://www.apache.org/) See
Apache LICENSE.
Copyright (C) 1995-2001 The Apache Group. All rights reserved.
Copyright (C) 1996 Dm. Kryukov; Copyright (C)
1997-2009 Alex Tutubalin. Design (C) 1998 Max Smolev.