+sub _recode_recursively {
+ my ($iconv, $param) = @_;
+
+ if (ref $param eq 'HASH') {
+ foreach my $key (keys %{ $param }) {
+ if (!ref $param->{$key}) {
+ $param->{$key} = $iconv->convert($param->{$key});
+ } else {
+ _recode_recursively($iconv, $param->{$key});
+ }
+ }
+
+ } elsif (ref $param eq 'ARRAY') {
+ foreach my $idx (0 .. scalar(@{ $param }) - 1) {
+ if (!ref $param->[$idx]) {
+ $param->[$idx] = $iconv->convert($param->[$idx]);
+ } else {
+ _recode_recursively($iconv, $param->[$idx]);
+ }
+ }
+ }
+}
+