Package: po4a
Version: 0.47-2
Severity: wishlist

For ASCII-only base text, when generating POT file with po4a-gettextize,
resulting POT file has invalid

"Content-Type: text/plain; charset=CHARSET\n"

Even when iy is specifically called with "-M utf-8".

This doesn't happen if English text has non-ascii sequence.

If called with "-M utf-8", even for ASCII only upstream text, this
should be:

"Content-Type: text/plain; charset=UTF-8\n"

Here is the use case causing trouble:

| po4a-gettextize -M utf-8 --format docbook -m test-ascii.xml | grep charset
| "Content-Type: text/plain; charset=CHARSET\n"
| po4a-gettextize -M utf-8 --format docbook -m test-ascii.xml | msgcat 
--no-location -o test-ascii.pot -
| <stdin>: warning: Charset "CHARSET" is not a portable encoding name.
|                   Message conversion to user's charset might not work.
| msgcat: present charset "CHARSET" is not a portable encoding name
| Makefile:4: recipe for target 'test-ascii.pot' failed
| make: [test-ascii.pot] Error 1 (ignored)
| po4a-gettextize -M utf-8 --format docbook -m test-utf8.xml | grep charset
| "Content-Type: text/plain; charset=UTF-8\n"
| po4a-gettextize -M utf-8 --format docbook -m test-utf8.xml | msgcat 
--no-location -o test-utf8.pot -

Test code is attached.

As I read po4a-gettextize line after 236
| # Parse master file forcing conversion to utf if it's not in ascii
| foreach my $file (@masterfile) {
|     $mastertt->read($file);
| }
| $mastertt->{TT}{utf_mode} = 1;
| if ($mastertt->{TT}{ascii_input}) {
|     $mastertt->detected_charset('ascii');
| } elsif (defined($mastchar)) {
|     $mastertt->detected_charset($mastchar);
|     $mastertt->{TT}{po_in}->set_charset($mastchar);
| }
| $mastertt->parse;


This is suspicious.

At least when "-M utf-8" is specified (I guess if $master == 'utf-8', it
should do something like

|     $mastertt->detected_charset('utf-8');
|     $mastertt->{TT}{po_in}->set_charset('utf-8');
 
even for ASCII case.  ASCII is UTF-8!

Osamu
-- System Information:
Debian Release: 9.0
  APT prefers testing-proposed-updates
  APT policy: (500, 'testing-proposed-updates'), (500, 'testing'), (98, 
'experimental'), (98, 'unstable')
Architecture: amd64
 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.10.0-rc6-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages po4a depends on:
ii  gettext                           0.19.8.1-2
ii  libsgmls-perl                     1.03ii-36
ii  opensp                            1.5.2-13+b1
ii  perl                              5.24.1-2
ii  perl-modules-5.24 [perl-modules]  5.24.1-2

Versions of packages po4a recommends:
ii  liblocale-gettext-perl     1.07-3+b1
ii  libterm-readkey-perl       2.37-1
ii  libtext-wrapi18n-perl      0.06-7.1
ii  libunicode-linebreak-perl  0.0.20160702-1+b1

po4a suggests no packages.

-- no debconf information

Attachment: testpo4a.tar.gz
Description: application/gzip

Reply via email to