[luatex] problem with slnunicode's find
luigi scarso
luigi.scarso at gmail.com
Wed Mar 3 11:57:47 CET 2010
On Wed, Mar 3, 2010 at 11:38 AM, Manuel Pégourié-Gonnard <mpg at elzevir.fr> wrote:
> 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 :-)
As I wrote, can be the only way . I would like something like this
--
-- this example can be totally wrong
-- it's just to show what I would like to see
--
function find_utf8_chars(str, pat)
local a, b = unicode.utf8.find(str, pat)
a = unicode.utf8.len(unicode.utf8.sub(str, 1, a))
b = unicode.utf8.len(unicode.utf8.sub(str, 1, b))
return a, b
end
If not possible , well you have hide details in your function
and it's also from ok a user point of view .
> By the way, that's the whole point of the discussion: unicode.utf8.find returns
> values with byte semantics...
It's not a problem anymore.
We all know now, and there is also a function that solves some problems.
--
luigi
More information about the luatex
mailing list