Package: po4a
Version: 0.28-1
Severity: normal
Tags: patch

Hello.

/usr/bin/po4a-translate -k 0 -f sgml -m ../en/release-notes.en.sgml -p 
release-notes.ru.po -l 
release-notes.ru.sgml -o ignore-inclusion="dynamicdata shareddata"

If PO file is used an UTF-8(where one character has occuped 2 and more bytes, 
Cyrillic
for example), then the lines of the resulting file(release-notes.ru.sgml) is 
too 
short(less then 60 symbols).
It happens because of wrong calculation of length of a UTF-8 lines.
Attached patch is solved this problem, but only with wrapping.
I have not searched all places where a lenght calculation is may affected too.

Regards,
Yuri Kozlov
-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-2-amd64-k8
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)

Versions of packages po4a depends on:
ii  gettext                   0.14.6-1       GNU Internationalization utilities
ii  libsgmls-perl             1.03ii-31      Perl modules for processing SGML p
ii  perl                      5.8.8-4        Larry Wall's Practical Extraction 
ii  perl-modules              5.8.8-4        Core Perl modules
ii  sp                        1.3.4-1.2.1-47 James Clark's SGML parsing tools

Versions of packages po4a recommends:
ii  liblocale-gettext-perl        1.05-1     Using libc functions for internati
pn  libterm-readkey-perl          <none>     (no description available)
ii  libtext-wrapi18n-perl         0.06-5     internationalized substitute of Te

-- no debconf information
--- /usr/share/perl5/Locale/Po4a/Po.pm  2006-08-22 16:21:57.000000000 +0400
+++ Po.pm       2006-09-24 19:14:11.000000000 +0400
@@ -776,7 +776,13 @@
     }
 
     if ($opt{'wrap'}) {
-       $res=wrap ($res, $opt{'wrapcol'} || 76);
+       if ($self->get_charset eq "UTF-8") {
+            $res=Encode::decode_utf8($res);
+            $res=wrap ($res, $opt{'wrapcol'} || 76);
+            $res=Encode::encode_utf8($res);
+       } else {
+            $res=wrap ($res, $opt{'wrapcol'} || 76);
+       }
     }
 #    print STDERR "Gettext >>>$text<<<(escaped=$esc_text)=[[[$res]]]\n\n";
     return $res;

Reply via email to