Thread JSON UTF decode
(46 answers)
Opened by bianca at 2013-06-17 06:12
Ungetestet:
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 sub decode_obj { my $r = $_[0]; if ( ref($r) eq "HASH" ) { for ( keys %$r ) { $r->{$_} = decode_obj( $r->{$_} ); } } elsif ( ( ref($r) eq "ARRAY" ) ) { for ( 0 .. @$r - 1 ) { $r->[$_] = decode_obj( $r->[$_] ); } } unless ( ref($r) ) { # Zeichenkette o. ä. $r = Encode::encode( 'ISO-8859-15', $r ); } return $r; } |