[Po4a-devel]Some encoding issues

Nicolas François nicolas.francois@centraliens.net
Sun, 13 Mar 2005 15:13:22 +0100


--uAKRQypu60I7Lcqm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hello,

I think I've got it:

The input charset in latin1, the po charset is UTF-8.
Po.pm::gettext tries to find a latin1 string in the PO, and fails. It then
directly prints the latin1 string in the output document (probably with an
additional UTF-8 to UTF-8 re-encoding).

Here is a patch. A review is welcome.

I don't commit it right known, Alioth has some troubles.

Regards,
-- 
Nekral

--uAKRQypu60I7Lcqm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="po4a.diff"

--- lib/Locale/Po4a/TransTractor.pm     27 Feb 2005 00:05:01 -0000      1.59
+++ lib/Locale/Po4a/TransTractor.pm     13 Mar 2005 13:41:27 -0000
@@ -822,6 +822,10 @@
 	}
     }

+    if ($self->{TT}{po_in}->get_charset ne "CHARSET") {
+	Encode::from_to($string, $in_charset, $self->{TT}{po_in}->get_charset);
+    }
+
     my $transstring = $self->{TT}{po_in}->gettext($string,
 					'wrap'      => $options{'wrap'}||0,
 					'wrapcol'   => $options{'wrapcol'});

--uAKRQypu60I7Lcqm--