[luatex] problem with slnunicode's find
Manuel Pégourié-Gonnard
mpg at elzevir.fr
Wed Mar 3 11:38:35 CET 2010
luigi scarso a écrit :
> On Wed, Mar 3, 2010 at 10:19 AM, Manuel Pégourié-Gonnard <mpg at elzevir.fr> wrote:
>> function find_utf8_chars(str, pat)
>> local a, b = unicode.utf8.find(str, pat)
>> a = unicode.utf8.len(string.sub(str, 1, a))
>> b = unicode.utf8.len(string.sub(str, 1, b))
>> return a, b
>> end
> For example here I disagree because you mix string and unicode.utf8
> --- but it's my first look, I should check.
I think you should :-) It's a design decision by slnunicode developpers. Strings
are meant to be cut with byte-oriented string functions (like unicode.ascii.sub,
unicode.latin1.sub, or string.sub). Again, this is documented in unitest from
the slnunicode distribution.
By the way, that's the whole point of the discussion: unicode.utf8.find returns
values with byte semantics...
Manuel.
More information about the luatex
mailing list