cowsay miscalculates length of multibyte-UTF-8-characters
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cowsay (Debian) |
Fix Released
|
Unknown
|
|||
cowsay (Ubuntu) |
Fix Released
|
Low
|
François Marier | ||
Bug Description
Binary package hint: cowsay
Ubuntu 9.04
cowsay 3.03
When piping text containing multibyte-
$ echo "ää" | cowsay
______
< ää >
------
\ ^__^
\ (oo)\_______
(__)\ )\/\
|| ||
$ echo "aa" | cowsay
____
< aa >
----
\ ^__^
\ (oo)\_______
(__)\ )\/\
|| ||
Note that the top bubble's size is off by 2 characters.
The length of lines must be determined using UTF-8 functions, not basic array functions to determine the screen real estate used.
Changed in cowsay (Ubuntu): | |
status: | New → Fix Committed |
tags: | added: patch |
Changed in cowsay (Ubuntu): | |
status: | Fix Committed → In Progress |
tags: |
added: patch-needswork removed: patch |
Changed in cowsay (Debian): | |
status: | Unknown → Confirmed |
Changed in cowsay (Debian): | |
status: | Confirmed → Fix Released |
tags: |
added: patch-accepted-debian removed: patch-needswork |
Package: cowsay
Version: 3.03-6
Followup-For: Bug #254557
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
anthony@bohr:~$ cowsay '私のズボンは火事だ' _______ _______ _______ __ ------- ------- ------- --
||--- -w |
______
< 私のズボンは火事だ >
------
\ ^__^
\ (oo)\_______
(__)\ )\/\
|| ||
(No idea what the Japanese means, btw.)
Notice how the > does not line up properly. The bubble is too wide. In
case the unicode breaks, these two lines are the same width:
mmmmmmmmmmm mmmmmmm
私のズボンは火事だ
- -- System Information: en_US.UTF- 8 (charmap=UTF-8)
Debian Release: 3.1
APT prefers testing
APT policy: (500, 'testing'), (130, 'unstable'), (120, 'experimental')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.10-bohr
Locale: LANG=en_US.UTF-8, LC_CTYPE=
Versions of packages cowsay depends on:
ii perl [perl5] 5.8.4-8 Larry Wall's Practical Extraction
- -- no debconf information
-----BEGIN PGP SIGNATURE-----
z+IwlXqWf4RAka0 AJ9mBgtRKSk2eIj lxeWhOOtYHsI8mg CgjHlC jhlgTNDs=
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFCrpkZ+
qwooBE4eXb2HCqW
=QqgK
-----END PGP SIGNATURE-----