in reply to Re: UTF8 fun and games again
in thread UTF8 fun and games again
Hi,
Thanks for the reply. Here is the full test script:
Just gonna take a look at that link too
Cheers
Andy
Thanks for the reply. Here is the full test script:
#!/usr/bin/perl use strict; use lib './'; use Links qw/$IN $DB $CFG $USER/; use CGI::Carp qw(fatalsToBrowser); use JSON; use Unicode::String qw(latin1 utf8); use LWP::UserAgent; print "Content-Type: text/html \n\n"; my $key = 'xxxx'; my $string = Do_Translate("en","fr",'are you'); $DB->table('Links')->update( { Title => "êtes-vous" } , { ID => 32 +902 } ) || die $GT::SQL::error; # works $DB->table('Links')->update( { Title => $string } , { ID => 32902 +} ) || die $GT::SQL::error; # doesnt work 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"; 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})->l +atin1; }
Just gonna take a look at that link too
Cheers
Andy
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: UTF8 fun and games again
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 | |
by anneli (Pilgrim) on Oct 18, 2011 at 08:37 UTC |
In Section
Seekers of Perl Wisdom