[sup-talk] display_length issue with special-characters on non-UTF8 terminal

Tarko Tikan tarko at lanparty.ee
Sat Jun 13 07:13:06 EDT 2009


> (I'm assuming that your terminal encoding is not UTF-8.)

No, it's not.

> Does this patch fix the issue? If so, I will release an 0.8.1.

Yes it does. To me, this approach felt "hackish" so I didn't come up with a patch :) But I still don't have better idea how to fix it so it'll have to stay like this.

> +    if $encoding == "UTF-8"
> +      scan(/./u).size
> +    else
> +      size
> +    end

It would probably be correct to use:

if $encoding == "UTF-8"
	scan(/./u).size
else
	length
end

Thats because scan returns a array (hence using the size), without scan you are just invoking on string and it's correct to use length (for some reason size works too, backward compatibility?) 

-- 
tarko


More information about the sup-talk mailing list