#388689 tr: no UTF-8 support

Package:
coreutils
Source:
coreutils
Description:
GNU core utilities
Submitter:
martin f krafft
Date:
2025-07-13 13:01:02 UTC
Severity:
normal
Tags:
#388689#3
Date:
2006-09-21 23:28:07 UTC
From:
To:
Correct me if I am wrong, but this is a bug to me. The result should
be 'ü', not 'Ü'.

piper:~> echo Ü | xxd -ps
c39c0a
piper:~> echo Ü | LC_CTYPE=de_CH.UTF-8 sed -e 'y/[:upper:]/[:lower:]/' | xxd -ps
c39c0a

#388689#8
Date:
2006-09-22 05:20:49 UTC
From:
To:
martin f krafft wrote:

No argument there.
transliterate command.  You would need to specify them explicitly.
That would be suitable for a wishlist upstream for sed, not coreutils.
Until then I believe with sed you must use explicit lists such as this:

  echo abcuABCUÜ | LC_CTYPE=de_CH.UTF-8 sed 'y/ABCDEFGHIJKLMNOPQRSTUÜVWXYZ/abcdefghijklmnopqrstuüvwxyz/'
  abcuabcuü

But I know your intention was tr because of File: and bug report says
/usr/bin/tr (coreutils) and so your intended example was probably this
type of example instead:

  echo abcABC Ü | LC_ALL=de_CH.UTF-8 tr '[:upper:]' '[:lower:]'
  abcabc Ü

  echo abcABC Ü | LC_ALL=de_CH.UTF-8 tr -d '[:upper:]'
  abc Ü

  echo abcuABCU Ü | LC_ALL=de_CH.UTF-8 tr -d '[=U=]'
  abcuABC Ü

It is a known deficiency in coreutils in general that the utilities
are not multibyte aware.  The following can be found in the upstream
source package TODO file.

  Adapt tools like wc, tr, fmt, etc. (most of the textutils) to be
    multibyte aware.  The problem is that I want to avoid duplicating
    significant blocks of logic, yet I also want to incur only minimal
    (preferably `no') cost when operating in single-byte mode.

Some vendors have hacked in patches to make the utilities multibyte
aware but none of those patches have been considered clean enough to
incorporate into the upstream source yet.  Debian's maintainer has
stated that he does not want to diverge from upstream this radically.
The patches are very messy.  The best course of action would be to get
this resolved upstream with the functionally properly integrated.

Bob

#388689#11
Date:
2006-09-22 08:33:50 UTC
From:
To:
retitle 388689 tr: character classes don't include locale-specific characters
tags 388689 upstream
clone 388689 -1
reassign -1 sed
retitle -1 sed: character classes don't include locale-specific characters
thanks

also sprach Bob Proulx <bob@proulx.com> [2006.09.22.0720 +0200]:

Argh. I mean to file a bug against tr:

  $ echo Ü | LC_CTYPE=de_CH.UTF-8 tr '[:upper:]' '[:lower:]' | xxd -ps
  c39c0a

Sorry. I'll clone.

I agree with the maintainer's decision. I don't think I'll step in
to work with upstream because I've not enjoyed my previous attempts
to get stuff fixed in coreutils.

#388689#22
Date:
2008-01-22 19:56:51 UTC
From:
To:
forcemerge 139861 388689 431231
tags 139861 + upstream confirmed wontfix
found 139861 6.10~20071127-1
thanks

Hi,

I'm merging these bugs (all about tr not supporting UTF-8), that still
affects the current coreutils in experimental. "wontfix" indicates that
this is not going to be fixed by a debian-specific patch, but that the
problem should be fixed upstream first.

#388689#45
Date:
2019-09-10 22:53:20 UTC
From:
To:
Hi,

17 years later and this is still not fixed, and had half a dozen of
duplicats in BTS.

$ echo "Zażółć gęślą jaźń" | tr [:lower:] [:upper:]
ZAżółć GęśLą JAźń
$

Wrong.

This is pretty serious deficiency of tr IMHO. And there should be some
push to upstread any patches that fixes at least SOME tools in coreutils.