Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh 4.3.6 FreeBSD bug



On Sun, 4 May 2008 17:38:58 -0700
Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx> wrote:
> Can anyone confirm if these problems, outlined below, are widely seen or
> a platform issue?
>
> Note the differences between EURO SIGN first and POUND SIGN first,
> perhaps something to do with character width:
> €: EURO SIGN    [0x20ac]
> £: POUND SIGN   [0xa3]

I haven't seen any problems with either of these two characters on
any of the Fedora versions I've been using.

> Is this the problem which wcwidth() should fix?

No, it looks like something different.  wcwidth() tells the shell the
printing width; it's nothing to do with the number of bytes that make up
the character.  The symptom of wcwidth() failing is that the character
prints OK but the shell doesn't count the characters it's moving over or
deleting properly.

What does the following give for you (with pound sterling followed by Euro)?

% echo £€ | xxd
0000000: c2a3 e282 ac0a                           ......

0xc2 0xa3 is the pound sign in UTF-8 and 0xe2 0x82 0xac is the Euro
symbol.  If it's the same as what I get, then the conversion to UTF-8 is
correct.  One possibility for what's going wrong is that 0xe2 0x82 0xac
is being reported as an invalid character by mbtowc() and its
relatives.  The shell's line editor would pick this up and show the
individual bytes; a dumb display would simply dump out the bytes and if
the terminal is working they would show up OK.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author