Package: apt-listbugs
Version: 0.1.12
Severity: normal
Tags: patch

Dear Maintainer,

with certain config apt-listbugs leads to broken charset in exported xhtml file.
Config is:
export LC_ALL=C LANGUAGE=cs_CZ.UTF-8

This results that chosen po file is po/cs.po, but charset in header is 
"ANSI_X3.4-1968"
(i.e. C).

I'm not an ruby expert, but with this config using Locale.current.charset seems 
to help:
ruby -rgettext -e 'p Locale.charset'
"ANSI_X3.4-1968"
ruby -rgettext -e 'p Locale.current.charset'
"UTF-8"

Best regards,
Petr Vorel

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (900, 'unstable'), (500, 'stable'), (100, 'testing'), (50, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.13-trunk-amd64 (SMP w/2 CPU cores)
Locale: LANG=cs_CZ.UTF-8, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages apt-listbugs depends on:
ii  apt                           0.9.15.5+b1
ii  ruby                          1:1.9.3.4
ii  ruby-debian                   0.3.8+b2
ii  ruby-gettext                  3.0.3-2
ii  ruby-httpclient               2.3.3-2
ii  ruby-soap4r                   2.0.5-3
ii  ruby-xmlparser                0.7.2-3
ii  ruby1.9.1 [ruby-interpreter]  1.9.3.484-2

apt-listbugs recommends no packages.

Versions of packages apt-listbugs suggests:
ii  chromium [www-browser]              32.0.1700.123-2
ii  debianutils                         4.4
ii  elinks [www-browser]                0.12~pre6-4
ii  google-chrome-stable [www-browser]  33.0.1750.146-1
ii  iceweasel [www-browser]             24.3.0esr-1
ii  links [www-browser]                 2.8-1+b1
ii  links2 [www-browser]                2.8-1+b1
ii  lynx-cur [www-browser]              2.8.8pre5-1
ii  netsurf-gtk [www-browser]           2.9-2+b1
ii  opera [www-browser]                 12.16.1860
ii  opera-next [www-browser]            12.16.1860
ii  reportbug                           6.5.0
ii  w3m [www-browser]                   0.5.3-15

-- no debconf information
>From 17b9608868ecce851f416518a944314d6ab86973 Mon Sep 17 00:00:00 2001
From: Petr Vorel <petr.vo...@gmail.com>
Date: Wed, 12 Mar 2014 21:27:46 +0100
Subject: [PATCH] fix locale bug when locale file is localized, but encoding is
 wrong

Test with
export LC_ALL=C LANGUAGE=cs_CZ.UTF-8
Then texts are from po/cs.po, but charset in header is "ANSI_X3.4-1968"
---
 lib/apt-listbugs/logic.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/apt-listbugs/logic.rb b/lib/apt-listbugs/logic.rb
index d73051c..573b513 100644
--- a/lib/apt-listbugs/logic.rb
+++ b/lib/apt-listbugs/logic.rb
@@ -101,7 +101,7 @@ class AppConfig
 
     @arrow = "->"
     @xarrow = "-&gt;"
-    if Locale.charset == "UTF-8"
+    if Locale.current.charset == "UTF-8"
       @arrow = "→"
       @xarrow = "→"
     end
@@ -649,7 +649,7 @@ class Viewer
     def display_bugs_as_html(bugs, cur_pkgs, new_pkgs)
       tmp = Tempfile.new(["apt-listbugs", ".html"])
       tmp.chmod(0644)
-      tmp.puts "<?xml version=\"1.0\" encoding=\"#{Locale.charset}\"?>"
+      tmp.puts "<?xml version=\"1.0\" encoding=\"#{Locale.current.charset}\"?>"
       tmp.puts "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""
       tmp.puts "    \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\";>"
       tmp.puts "\n<html xmlns=\"http://www.w3.org/1999/xhtml\";>"
-- 
1.9.0.279.gdc9e3eb

Reply via email to