diff options
| author | fukachan <fukachan> | 2004-02-27 22:17:40 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2004-02-27 22:17:40 +0000 |
| commit | eee5d85b45ee00af72d301c54e55399a69ff2f05 (patch) | |
| tree | ab2ebf9196369a9b3a86e36476b1597bd1f967a1 | |
| parent | d34d113f840331325fa29155b950bb11649f833d (diff) | |
| download | fml8-eee5d85b45ee00af72d301c54e55399a69ff2f05.tar.gz fml8-eee5d85b45ee00af72d301c54e55399a69ff2f05.tar.bz2 fml8-eee5d85b45ee00af72d301c54e55399a69ff2f05.zip | |
define lang_to_charset().
fix return value for some methods.
use "print if $debug" in some cases.
| -rw-r--r-- | fml/lib/FML/Process/Utils.pm | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/fml/lib/FML/Process/Utils.pm b/fml/lib/FML/Process/Utils.pm index cf2dc4e8..d0831b76 100644 --- a/fml/lib/FML/Process/Utils.pm +++ b/fml/lib/FML/Process/Utils.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Utils.pm,v 1.105 2004/02/26 08:07:00 fukachan Exp $ +# $FML: Utils.pm,v 1.106 2004/02/26 13:19:37 fukachan Exp $ # package FML::Process::Utils; @@ -15,6 +15,8 @@ use FML::Log qw(Log LogWarn LogError); use File::Spec; use File::stat; +my $debug = 0; + =head1 NAME @@ -1590,16 +1592,38 @@ sub get_charset } } else { - $curproc->log("debug: no Accpet-Language:"); + $curproc->log("debug: no Accpet-Language:") if $debug; } } $charset ||= $default; - $curproc->log("debug: category=$category charset=$charset"); + $curproc->log("debug: category=$category charset=$charset") if $debug; return $charset; } +# Descriptions: convert lang (e.g. ja) to charset (e.g. iso-2022-jp). +# Arguments: OBJ($curproc) STR($category) STR($lang) +# Side Effects: none +# Return Value: none +sub lang_to_charset +{ + my ($curproc, $category, $lang) = @_; + my $config = $curproc->config(); + my $key = sprintf("%s_charset_%s", $category, $lang); + my $charset = $config->{ $key } || ''; + + if ($charset) { + return $charset; + } + else { + my $s = "category=$category lang=$lang charset=none"; + $curproc->logerror("lang_to_charset: $s"); + return 'us-ascii'; + } +} + + =head2 get_accept_language_list($list) set preferred language candidates requested by sender. @@ -1643,7 +1667,7 @@ sub get_accept_language_list my $pcb = $curproc->pcb(); if (defined $pcb) { - return $pcb->get('incoming_message', 'accept-language'); + return( $pcb->get('incoming_message', 'accept-language') || [] ); } else { return [ ]; |
