Originally Posted by ZOS_ChipHilseberg
Tell me if this is correct. You are requesting that we replace the lua string.find with our own UTF-8 compatible pattern matching?
|
Right. The pattern matching for all string functions that use patterns should be able correctly match UTF8 characters. What I see in the Lua source code, it uses some standard c-methods to do the matching:
Code:
static int match_class (int c, int cl) {
int res;
switch (tolower(cl)) {
case 'a' : res = isalpha(c); break;
case 'c' : res = iscntrl(c); break;
case 'd' : res = isdigit(c); break;
case 'l' : res = islower(c); break;
case 'p' : res = ispunct(c); break;
case 's' : res = isspace(c); break;
case 'u' : res = isupper(c); break;
case 'w' : res = isalnum(c); break;
case 'x' : res = isxdigit(c); break;
case 'z' : res = (c == 0); break;
default: return (cl == c);
}
return (islower(cl) ? res : !res);
}
These would have to be replaced with some other functions that support utf8, like in
luautf8.