Package: tree Version: 1.5.2.1-1 Severity: normal Tags: patch l10n It seems that the current locale is not taken into account when displaying file names:
% mkdir tmp % touch tmp/eeeéee % tree tmp tmp `-- eee\303\251ee 0 directories, 1 file By examining the sources, my understanding is that setlocale(LC_CTYPE, "") should be called *before* examining MB_CUR_MAX, otherwise it will return 1 because the locale is set to "C" by default, as indicated by setlocale(3): "(...) On startup of the main program, the portable "C" locale is selected as default. A program may be made portable to all locales by calling: setlocale(LC_ALL, ""); (...)" The attached patch works for me: % ./tree tmp tmp `-- eeeéee 0 directories, 1 file Best regards, -Christian -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 2.6.26.5-mooch.1-amd64 (SMP w/2 CPU cores; PREEMPT) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF8) Shell: /bin/sh linked to /bin/bash Versions of packages tree depends on: ii libc6 2.7-15 GNU C Library: Shared libraries tree recommends no packages. tree suggests no packages. -- no debconf information
--- tree.c.orig 2008-11-01 19:18:07.000000000 +0100 +++ tree.c 2008-11-01 19:18:56.264797154 +0100 @@ -209,6 +209,8 @@ dirs[0] = 0; Level = -1; + setlocale(LC_CTYPE, ""); + /* Until I get rid of this hack, make it linux/cygwin only: */ #if defined (LINUX) || defined (CYGWIN) mb_cur_max = (int)MB_CUR_MAX; @@ -216,8 +218,6 @@ mb_cur_max = 1; #endif - setlocale(LC_CTYPE, ""); - memset(utable,0,sizeof(utable)); memset(gtable,0,sizeof(gtable)); memset(itable,0,sizeof(itable));