Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Feb 2006 17:58:52 +0100 (CET)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-stable@FreeBSD.ORG
Subject:   Re: tr(1) buggy with de_DE.ISO8859-1(5) locale?
Message-ID:  <200602061658.k16GwqLr068150@lurza.secnetix.de>
In-Reply-To: <43E3B356.7030203@nurfuerspam.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Martin <nakal@nurfuerspam.de> wrote:
 > There is a quite nasty bug in tr(1) when using
 > de_DE.ISO8859-1(5) locale.

It's not a bug.  It's perfectly POSIX-compatible.

 > unsetenv LC_ALL
 > setenv LANG de_DE.ISO8859-1
 > echo v | tr a-z A-Z
 > 
 > I'm getting "W" as result. Shouldn't it be "V"?

No, it should be "W".

To convert lower case to upper case, use the command
"tr '[:lower:]' '[:upper:]'" (or enumerate all letters
explicitely, like "tr abcdef ABCDEF").  Skripts that
use things like "tr a-z A-Z" are broken and need to be
fixed.

By the way:  Do not set LANG or LC_ALL, expecially for
the root user, and especially when compiling things.
Not only will tr behave in unexpected ways when used
like above, but also other things might break.  For
example, German month names appear in "ls -l", which
will break scripts that try to parse them.  Some tools
use decimal commas instead of decimal points, which
can lead to further confusion, etc.  Yes, scripts
which try to do that are broken, but they do exist.

If you only need support for German umlauts, then only
set LC_CTYPE.  That shouldn't break anything.

Best regards
   Oliver

-- 
Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"I invented Ctrl-Alt-Delete, but Bill Gates made it famous."
        -- David Bradley, original IBM PC design team



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602061658.k16GwqLr068150>