Reputation: 366
I can't find any good implementation of string.lower
for utf8 characters in pure Lua. Either it's a C++ library, which I can't use, because I have no access to the C-part in the project, or so called 'implementation' where utf8.lower
just defaults to the string.lower
. Obviously it doesn't work.
Is there a solution? Maybe someone can give a hint on how to implement this thing?
Upvotes: 5
Views: 878
Reputation: 474366
Performing case conversion in Unicode (regardless of encoding) is not a simple exercise. Implementing Unicode case conversion requires access to Unicode characters property tables, and the algorithm itself is not merely "if character is uppercase, replace with lowercase version" because many languages don't have a 1:1 case conversion mapping for all characters.
That's not to say that it can't be done. But there's a reason why most people who need serious Unicode work default to using ICU or other libraries rather than coding their own.
Upvotes: 2