bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UTF8 and printf '%2s' (coreutils 5.2.1)


From: Tobias Burnus
Subject: Re: UTF8 and printf '%2s' (coreutils 5.2.1)
Date: Wed, 04 Aug 2004 20:49:50 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040617

Hello,

I (Tobias Burnus) wrote:

/usr/bin/printf 'A%2sB\n' '²'
# Prints A²B instead of A ²B
In other words: printf counts 2byte UTF-8 characters as two characters
instead of one.

Re-reading the POSIX standard,  I've to admit that coreutils' prinf does
the right thing:
POSIX requires that the bytes and not the number of characters count.

(BASH 2.05b's built-in printf has by the way the same problem, which
is fixed in BASH 3.0.)

(I cannot reproduce the 'error' in BASH 3.0, i.e. it seems as if
everything is POSIX conform.)

Sorry for the spam.

Tobias




reply via email to

[Prev in Thread] Current Thread [Next in Thread]