Skip Menu |

This queue is for tickets about the WWW-Babelfish CPAN distribution.

Report information
The Basics
Id: 18359
Status: open
Priority: 0/
Queue: WWW-Babelfish

People
Owner: Nobody in particular
Requestors: FANY [...] cpan.org
Cc: durist [...] frii.com
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



CC: durist [...] frii.com
Subject: text containing umlauts does not get translated properly
With WWW::Babelfish 0.13 I wasn't able to translate texts or words containing German umlauts, e.g. "für" did not translate into "for". However, it worked when I used my browser. I'm anything but an expert for charset issues, but by comparing a tcpdump of the request my browser sent with that one issued by a test script... perl -MWWW::Babelfish -e 'print WWW::Babelfish->new->translate(qw(source German destination English text),"für")' ... I finally found out that adding a "Accept-Charset: utf-8" header helps to make that work. You'll find a patch attached. Regards, fany
Subject: Babelfish_utf8.patch
--- Babelfish.pm.orig 2005-08-07 04:58:35.000000000 +0200 +++ Babelfish.pm 2006-03-25 18:07:22.000000000 +0100 @@ -42,7 +42,8 @@ translaterequest => sub { my($langpair, $text) = @_; my $req = POST ( 'http://babelfish.altavista.com/babelfish/tr?il=en', - [ 'doit' => 'done', 'urltext' => encode("utf8",$text), 'lp' => $langpair, 'Submit' => 'Translate', 'enc' => 'utf8' ]); + [ 'doit' => 'done', 'urltext' => encode("utf8",$text), 'lp' => $langpair, 'Submit' => 'Translate', 'enc' => 'utf8' ], + qw(Accept-Charset utf-8) ); return $req; },
Subject: a280033fb0@lpv.lv
From: a280033fb0 [...] lpv.lv
Fabulous site.
Subject: a280033fb0@porkor.lv
From: a280033fb0 [...] porkor.lv
Text: a280033fb0070a945c096df9a29789741 <a href="a280033fb0070a945c096df9a297897410">a280033fb0070a945c096df9a297897410</a> [a]a280033fb0070a945c096df9a297897411[/a] [a href=a280033fb0070a945c096df9a297897412]a280033fb0070a945c096df9a297897412[/a] [a href="a280033fb0070a945c096df9a297897413"]a280033fb0070a945c096df9a297897413[/a] [link]a280033fb0070a945c096df9a297897414[/link] [link=a280033fb0070a945c096df9a297897415]a280033fb0070a945c096df9a297897415[/link] [link="a280033fb0070a945c096df9a297897416"]a280033fb0070a945c096df9a297897416[/link] [url]a280033fb0070a945c096df9a297897417[/url] [url=a280033fb0070a945c096df9a297897418]a280033fb0070a945c096df9a297897418[/url] [url="a280033fb0070a945c096df9a297897419"]a280033fb0070a945c096df9a297897419[/url]
Subject: aac@yahoo.com
From: aac [...] yahoo.com
keep creating... Kris
In v0.16, the "Babelfish" service passes the header "Accept-Charset: utf-8" ($Services->{Babelfish}{translaterequest}), but the "Yahoo" service does not. I was able to "fix" the Yahoo service in v0.16 -- get it to respond with UTF-8 -- by making a similar fix to the Yahoo service in Babelfish.pm: 119c119,120 < [ 'ei' => 'UTF-8', 'doit' => 'done', 'tt' => 'urltext', 'trtext' => encode("utf8",$text), 'lp' => $langpair, 'btnTrTxt' => 'Translate', 'intl' => '1' ]); --- Show quoted text
> [ 'ei' => 'UTF-8', 'doit' => 'done', 'tt' => 'urltext', 'trtext' => encode("utf8",$text), 'lp' => $langpair, 'btnTrTxt' => 'Translate', 'intl' => '1' ], > qw(Accept-Charset utf-8));