Advanced

Any UTF-8 support?

Any UTF-8 support?
July 19, 2018 09:14AM
Is there any UTF-8 supporting extensions available after upgrade to Mediawiki's LUA sandbox?

I mean something mentioned in this article http://lua-users.org/wiki/LuaUnicode
Re: Any UTF-8 support?
August 20, 2018 11:20AM
currently a few function for utf8 strings are available:

PGC.UTF8SubStr(string,start,length )
start is counted from 1, currently there is a bug for negative start (counting from the end of string)
if length is not specified, entire rest of string is returned

PGC.UTF8ToLower(string)
PGC.UTF8ToUpper(string)

currently there is no function for count the number of characters of the utf8 string, however you can easely define it.

function UTF8Len(str)
  return str:gsub("[\128-\191]", "" ):len()
end

added later:
now there is official PGC function
PGC.UTF8Len(string)



Edited 1 time(s). Last edit at 11/12/2018 01:37PM by jpavlik. (view changes)
Sorry, you do not have permission to post/reply in this forum.