7 use vars qw(%converters);
10 my ($from_charset, $to_charset) = @_;
12 my $index = "${from_charset}::${to_charset}";
13 if (!$converters{$index}) {
14 $converters{$index} = Text::Iconv->new($from_charset, $to_charset) || die;
17 return $converters{$index};
21 my ($from_charset, $to_charset, $text) = @_;
23 $from_charset ||= Common::DEFAULT_CHARSET;
24 $to_charset ||= Common::DEFAULT_CHARSET;
26 my $converter = get_converter($from_charset, $to_charset);
27 return $converter->convert($text);