View Single Post
02/19/19, 03:13 PM   #9
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
Originally Posted by ZOS_ChipHilseberg View Post
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.
  Reply With Quote