On Mon, Apr 06, 2015 at 10:50:07AM +0200, Roberto E. Vargas Caballero wrote: > > ascii code may only be checked for characters that have length equal to > > 1, not width equal to 1 > > I think they are equivalent, but I like more the 'len' versin, so > I will apply it.
They are not equivalent at all. 'len' is the length of the character in bytes, it is 1 for ASCII, so you can check 'ascii' variable. 'width' is how much columns the character takes. It is one for 'ß' as it takes only one column to display, but the length of 'ß' is 2 bytes. Using 'ascii' variable in this case is wrong as it contains the first byte of UTF-8 encoding. It happens to be 030, 032, 033 by accident for non-latin characters and part of the string that should be, for example, a part of the terminal title, is displayed in the terminal, breaking layout.