ultranerds has asked for the wisdom of the Perl Monks concerning the following question:
This prints out fine in PuttY (with UTF8 set as the encoding type);sub Do_Translate { my ($from,$to,$string) = @_; my $url = "https://www.googleapis.com/language/translate/v2?key=$k +ey&q=$string&source=$from&target=$to"; # print "getting URL: $url \n"; #my $page = get($url); my $ua = LWP::UserAgent->new(); my $body = $ua->get($url); my $json = from_json($body->decoded_content); use Data::Dumper; print Dumper($json); print "GOT: $json->{data}->{translations}[0]->{translatedText} \n" +; return utf8($json->{data}->{translations}[0]->{translatedText} +)->latin1; }
...yet when I update this value in the database, it converts it to:GOT: êtes-vous $VAR1 = 'êtes-vous';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: UTF8 fun and games again
by moritz (Cardinal) on Oct 17, 2011 at 18:10 UTC | |
by ultranerds (Hermit) on Oct 17, 2011 at 18:13 UTC | |
by moritz (Cardinal) on Oct 17, 2011 at 18:20 UTC | |
by ultranerds (Hermit) on Oct 17, 2011 at 18:28 UTC | |
by ultranerds (Hermit) on Oct 17, 2011 at 18:37 UTC | |
|