jed-users mailing list

[2003 Date Index] [2003 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: slang: UTF-8 and strlen


Romano Giannetti <romano@xxxxxxxxxxxxxxxx> wrote:
>Well, the problem is: if strlen is mainly used to count "how much visual
>space" the string occupy on screen, option #3 is the correct one; not only,
>but you should take into account wide char that occupy 2 places. But I do
>not know how this can mix with searching etc etc.

It is not really used to determine the amount of visual space.  For
example, how much visual space does a tab have?  Rather, it is used
most often to indicate how many characters are present, where a
character in this context includes combining characters.  Of course a
combining character by itself is meaningless.

>I would like to suggest to borrow "wcswidth", "wcslen" (man 3 wcswidth) 
>and company,  aka the the POSIX wide-char string visual lenght attribute. Or
>add to strlen an "encoding" optional parameter.

I did not borrow these function because there is no guarantee that
they are well supported everywhere.  So, I had to construct my own
tables to deal with unicode.  It was also a good learning experience.

Thanks,
--John

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2003 date index] [2003 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]