[Aptitude-devel] Bug#950334: aptitude: Help -> User's Manual contains special characters
Diego Escalante
diegoe at gnome.org
Mon Aug 3 23:54:31 BST 2020
Package: aptitude
Version: 0.8.13-1+b1
Followup-For: Bug #950334
X-Debbugs-Cc: diegoe at gnome.org
This is actually a broader bug and not related to specific locales.
The issue is that `src/ui.cc` defaults to transcoding the README files
to ISO-8859-1, and since all the README files are already UTF-8, you get
glitchy glyphs.
I'm attaching a patch for this specific issue, but note that I have an
open MR which includes this and a few more encoding related fixes:
https://salsa.debian.org/apt-team/aptitude/-/merge_requests/10/commits
Note also that I wasn't able to properly test this because of the
current FTBFS in:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=966875
But that said, this is merely a string replacement, shouldn't be
problematic.
-- Package-specific info:
Terminal: xterm-256color
$DISPLAY is set.
which aptitude: /usr/bin/aptitude
aptitude version information:
aptitude 0.8.13
Compiler: g++ 9.3.0
Compiled against:
apt version 6.0.0
NCurses version 6.2
libsigc++ version: 2.10.2
Gtk+ support disabled.
Qt support disabled.
Current library versions:
NCurses version: ncurses 6.2.20200212
cwidget version: 0.5.18
Apt version: 6.0.0
aptitude linkage:
linux-vdso.so.1 (0x00007ffcc57a8000)
libapt-pkg.so.6.0 => /lib/x86_64-linux-gnu/libapt-pkg.so.6.0 (0x00007fbc70029000)
libncursesw.so.6 => /lib/x86_64-linux-gnu/libncursesw.so.6 (0x00007fbc6ffee000)
libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007fbc6ffbf000)
libsigc-2.0.so.0 => /lib/x86_64-linux-gnu/libsigc-2.0.so.0 (0x00007fbc6ffb6000)
libcwidget.so.4 => /lib/x86_64-linux-gnu/libcwidget.so.4 (0x00007fbc6feb0000)
libsqlite3.so.0 => /lib/x86_64-linux-gnu/libsqlite3.so.0 (0x00007fbc6fd84000)
libboost_iostreams.so.1.71.0 => /lib/x86_64-linux-gnu/libboost_iostreams.so.1.71.0 (0x00007fbc6fd5b000)
libxapian.so.30 => /lib/x86_64-linux-gnu/libxapian.so.30 (0x00007fbc6fb41000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fbc6fb1f000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fbc6f952000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fbc6f80e000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fbc6f7f4000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fbc6f62d000)
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007fbc6f613000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fbc6f5f6000)
libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007fbc6f5e3000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fbc6f5ba000)
liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007fbc6f598000)
libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007fbc6f4ec000)
libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007fbc6f4c6000)
libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007fbc6f41b000)
libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007fbc6f2fe000)
/lib64/ld-linux-x86-64.so.2 (0x00007fbc70684000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fbc6f2f8000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fbc6f2eb000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007fbc6f2e2000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007fbc6f2bf000)
-- System Information:
Debian Release: bullseye/sid
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 5.7.0-2-amd64 (SMP w/4 CPU threads)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages aptitude depends on:
ii aptitude-common 0.8.13-1
ii libapt-pkg6.0 2.1.7
ii libboost-iostreams1.71.0 1.71.0-6+b2
ii libc6 2.31-2
ii libcwidget4 0.5.18-5
ii libgcc-s1 10.2.0-3
ii libncursesw6 6.2-1
ii libsigc++-2.0-0v5 2.10.2-1
ii libsqlite3-0 3.32.3-1
ii libstdc++6 10.2.0-3
ii libtinfo6 6.2-1
ii libxapian30 1.4.15-1
Versions of packages aptitude recommends:
ii libdpkg-perl 1.20.5
ii sensible-utils 0.0.12+nmu1
Versions of packages aptitude suggests:
pn apt-xapian-index <none>
pn aptitude-doc-en | aptitude-doc <none>
pn debtags <none>
ii tasksel 3.59
-- no debconf information
-------------- next part --------------
>From 0cb1886fbbb0d6339bbd9458bc185b6d82d611af Mon Sep 17 00:00:00 2001
From: Diego Escalante Urrelo <diegoe at gnome.org>
Date: Mon, 3 Aug 2020 17:29:17 -0500
Subject: [PATCH] ui: Default README encoding to UTF-8
The ui uses a hint string to match the different README files to the
respective encoding that they use, however this still defaults to
ISO-8859-1 even when all README.nn files are UTF-8.
Because of this default, the UI would transcode the README.nn file to
ISO-8859-1 in the following situations:
* The po/nn.po file has naively translated the encoding hint as
ISO-8859-1
* The po/nn.po file has not translated the encoding hint
* No translation is being used at the moment
This defaults the hint string to UTF-8, solving the above.
Note that the already translated hint strings in the po/nn.po files
won't be used anymore, since this is a new `msgid`, but since all our
README files are UTF-8 anyway, said hint is not really needed anymore.
Closes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=950334
---
src/ui.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/ui.cc b/src/ui.cc
index 89f15aab..8dee892d 100644
--- a/src/ui.cc
+++ b/src/ui.cc
@@ -1181,13 +1181,13 @@ static void do_help_readme()
// Look up the translation of README.
// TRANSLATORS: You can translate README and set the filename here.
std::string readme_file = ssprintf(HELPDIR "/%s", P_("Localized file|README"));
- const char *encoding = P_("Encoding of README|ISO_8859-1");
+ const char *encoding = P_("Encoding of README|UTF-8");
// Deal with missing localized docs.
if(access(readme_file.c_str(), R_OK)!=0)
{
readme_file = HELPDIR "/README";
- encoding = "ISO_8859-1";
+ encoding = "UTF-8";
}
setup_fileview(readme_file,
--
2.27.0
More information about the Aptitude-devel
mailing list