Subject: | Encoding problems with non-latin1 data and json transport |
With the following script:
#!/usr/bin/perl
use strict;
use Geo::Coder::GoogleMaps;
my $apikey = ...;
my $gmap = Geo::Coder::GoogleMaps->new(apikey => $apikey);
my $location = $gmap->geocode(location => 'Djakovo, Croatia');
print $location->{data}{address}, "\n";
__END__
I get the result "\u0110akovo, Croatia". It seems that the first
character (D with a stroke) was not decoded properly. I don't know if
JSON::Syck does support javascript escapes at all, or if you better
switch to JSON::XS instead?
Also, if I try to use "Basks Voda, Croatia" as input, then the output is
(using Data::Dumper notation): "Ba\x{9a}ka Voda, Croatia". This also
does not right, as \x9a is not a valid (Unicode) character. It looks
rather like a Windows-1252 fallback (for the letter "S with caron").
This is probably the fault of Google, but it would be nice if this could
also be workarounded.
Regards,
Slaven