[luatex] problem with slnunicode's find
Patrick Gundlach
patrick at gundla.ch
Tue Mar 2 19:09:29 CET 2010
>> What would
>> you suggest the following statement returns?
>>
>> str="aö" unicode.utf8.find(str,"\182") -- (ö's utf8 values are 195
>> and 182)
>
> Nil, or even better error out, since the second argument is invalid.
That would break every program that uses unicode.utf8 as a replacement for string, which is meant for. How would you then search for a byte sequence in another byte sequence?
> Do you think 3 is a sensible result?
Yes, and the only sensible result.
And what would you expect in this case:
my_three_numbers = "\97\195\182" unicode.utf8.find(my_three_numbers,"\182")
and in this case:
my_three_numbers = "\97\195\182" string.find(my_three_numbers,"\182")
?
This discussion is getting ridiculous, and I'll stop here. If you want something that returns utf-8 lengths then please write a wrapper around the find function yourself.
Patrick
More information about the luatex
mailing list