Your message dated Wed, 05 Oct 2005 14:17:05 -0700
with message-id <[EMAIL PROTECTED]>
and subject line Bug#226023: fixed in less 391-1
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 3 Jan 2004 20:52:11 +0000
>From [EMAIL PROTECTED] Sat Jan 03 14:52:09 2004
Return-path: <[EMAIL PROTECTED]>
Received: from dd1234.kasserver.com [81.209.148.157] 
        by master.debian.org with esmtp (Exim 3.35 1 (Debian))
        id 1AcpR2-0001ZS-00; Sat, 03 Jan 2004 11:19:36 -0600
Received: from plonk (unknown [192.146.136.129])
        by dd1234.kasserver.com (Postfix) with ESMTP
        id 4F6104E5CE; Sat,  3 Jan 2004 18:19:15 +0100 (CET)
Received: from voss by plonk with local (Exim 4.30)
        id 1AcpQy-0001Ex-J0; Sat, 03 Jan 2004 17:19:32 +0000
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: Jochen Voss <[EMAIL PROTECTED]>
To: Debian Bug Tracking System <[EMAIL PROTECTED]>
Subject: less: does not properly detect UTF-8 locales
X-Mailer: reportbug 2.37
Date: Sat, 03 Jan 2004 17:19:32 +0000
Message-Id: <[EMAIL PROTECTED]>
Sender: Jochen Voss <[EMAIL PROTECTED]>
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 
        2.60-master.debian.org_2003_11_25-bugs.debian.org_2004_1_3 
        (1.212-2003-09-23-exp) on master.debian.org
X-Spam-Status: No, hits=-5.0 required=4.0 tests=HAS_PACKAGE autolearn=no 
        version=2.60-master.debian.org_2003_11_25-bugs.debian.org_2004_1_3
X-Spam-Level: 

Package: less
Version: 381-2
Severity: normal
Tags: patch

Hello,

less uses a heuristic to detect UTF-8 locales, which sometimes does
not work.  From the manual page:

    If neither LESSCHARSET nor LESSCHARDEF is set, but the string
    "UTF-8" is found in the LC_ALL, LC_TYPE or LANG environment
    variables, then the default character set is utf-8.

This method does fail for locales like "de_DE.utf8".  A symptom
of this are garbled manual pages on UTF-8 terminals.

A better solution would be to use the 'nl_langinfo' function to
determine the character encoding of the user's locale, and to
use the utf-8 mode of less, if the character encoding is UTF-8.

This is implemented by the following patch.  I use nl_langinfo
unconditionally here, because on Debian systems this will
(hopefully) always be available.  If you think that this a bad idea
I volunteer to add the necessary configure tests to my patch.

== patch starts at following line ==========================
diff -ur less-381/charset.c less-381.new/charset.c
--- less-381/charset.c  2003-01-18 04:55:15.000000000 +0000
+++ less-381.new/charset.c      2004-01-03 17:03:38.000000000 +0000
@@ -18,6 +18,7 @@
 #if HAVE_LOCALE
 #include <locale.h>
 #include <ctype.h>
+#include <langinfo.h>
 #endif
 
 public int utf_mode = 0;
@@ -219,6 +220,26 @@
 /*
  * Initialize charset data structures.
  */
+
+       static int
+utf8_encoding_used()
+/* stolen from the GNU libc manual */
+{
+       char *old_locale, *saved_locale;
+       int  res;
+
+       old_locale = setlocale (LC_CTYPE, NULL); /* save old locale */
+       saved_locale = strdup (old_locale);
+       setlocale (LC_CTYPE, "");       /* set locale from environment */
+
+       res = (strcmp (nl_langinfo (CODESET), "UTF-8") == 0);
+
+       setlocale (LC_CTYPE, saved_locale); /* restore old locale */
+       free (saved_locale);
+
+       return  res;
+}
+
        public void
 init_charset()
 {
@@ -243,6 +264,15 @@
                return;
        }
 
+       /*
+        * Check whether UTF-8 is used.
+        */
+       if (utf8_encoding_used ()) {
+               fprintf (stderr, "CODESET=%s\n", nl_langinfo (CODESET));
+               if (icharset("utf-8"))
+                       return;
+       }
+
 #if HAVE_STRSTR
        /*
         * Check whether LC_ALL, LC_CTYPE or LANG look like UTF-8 is used.
== patch ends at previous line =============================

I hope this helps,

Jochen


-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux plonk 2.4.21 #1 Tue Oct 21 23:04:41 BST 2003 i686
Locale: [EMAIL PROTECTED], LC_CTYPE=de_DE.utf8

Versions of packages less depends on:
ii  debianutils               2.6.1          Miscellaneous utilities specific t
ii  libc6                     2.3.2.ds1-10   GNU C Library: Shared libraries an
ii  libncurses5               5.3.20030719-4 Shared libraries for terminal hand

-- no debconf information


---------------------------------------
Received: (at 226023-close) by bugs.debian.org; 5 Oct 2005 21:19:15 +0000
>From [EMAIL PROTECTED] Wed Oct 05 14:19:15 2005
Return-path: <[EMAIL PROTECTED]>
Received: from katie by spohr.debian.org with local (Exim 3.36 1 (Debian))
        id 1ENGdN-0004AI-00; Wed, 05 Oct 2005 14:17:05 -0700
From: Thomas Schoepf <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
X-Katie: $Revision: 1.56 $
Subject: Bug#226023: fixed in less 391-1
Message-Id: <[EMAIL PROTECTED]>
Sender: Archive Administrator <[EMAIL PROTECTED]>
Date: Wed, 05 Oct 2005 14:17:05 -0700
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Level: 
X-Spam-Status: No, hits=-6.0 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER 
        autolearn=no version=2.60-bugs.debian.org_2005_01_02
X-CrossAssassin-Score: 3

Source: less
Source-Version: 391-1

We believe that the bug you reported is fixed in the latest version of
less, which is due to be installed in the Debian FTP archive:

less_391-1.diff.gz
  to pool/main/l/less/less_391-1.diff.gz
less_391-1.dsc
  to pool/main/l/less/less_391-1.dsc
less_391-1_i386.deb
  to pool/main/l/less/less_391-1_i386.deb
less_391.orig.tar.gz
  to pool/main/l/less/less_391.orig.tar.gz



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [EMAIL PROTECTED],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Thomas Schoepf <[EMAIL PROTECTED]> (supplier of updated less package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [EMAIL PROTECTED])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Wed,  5 Oct 2005 18:04:29 +0200
Source: less
Binary: less
Architecture: source i386
Version: 391-1
Distribution: unstable
Urgency: low
Maintainer: Thomas Schoepf <[EMAIL PROTECTED]>
Changed-By: Thomas Schoepf <[EMAIL PROTECTED]>
Description: 
 less       - Pager program similar to more
Closes: 180618 180625 226023 237427 249594 257068 269993 314248 314249
Changes: 
 less (391-1) unstable; urgency=low
 .
   * New upstream version.
   * Closes: #180625: less: doesn't correctly display multibyte chars in search
     string
   * Closes: #180618: less: wrong - signs in utf-8
   * Closes: #226023: less: does not properly detect UTF-8 locales
   * Closes: #237427: Segfault when directory is deleted while in help screen
   * Closes: #249594: less: ignore-case in searches doesn't ignore case
   * Closes: #257068: less: add [] to DEF_METACHARS
   * Closes: #269993: less: search history across sessions would be nice
   * Closes: #314248: less: Search command does not accept UTF-8
     multibyte characters
   * Closes: #314249: less should filter non-printable (raw) characters
     of the filename
Files: 
 2aeb697a919382608dff1cace587d5ce 568 text standard less_391-1.dsc
 33934a213351e989ebe019504a54383e 280519 text standard less_391.orig.tar.gz
 9d0f91a002e217b8ebbd106ecd551f3c 14792 text standard less_391-1.diff.gz
 243f8c8deb8aa4b2eaa0cf2d6fee4c83 110038 text standard less_391-1_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iEYEARECAAYFAkNEQZ0ACgkQBL31vrD6T0ldOQCfcTOlAf9nre9lxyt2YAR8vsX4
likAoI5Xd0tLLuijPhQR5pgJj3hks3C3
=nNIp
-----END PGP SIGNATURE-----


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to