mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Fix folder path truncation in filemanager with utf8 chars (#3599)
This commit is contained in:
@@ -129,6 +129,13 @@ function util.lastIndexOf(string, ch)
|
||||
if i == nil then return -1 else return i - 1 end
|
||||
end
|
||||
|
||||
--- Reverse the individual greater-than-single-byte characters
|
||||
-- @string string to reverse
|
||||
-- Taken from https://github.com/blitmap/lua-utf8-simple#utf8reverses
|
||||
function util.utf8Reverse(text)
|
||||
text = text:gsub('[%z\1-\127\194-\244][\128-\191]*', function (c) return #c > 1 and c:reverse() end)
|
||||
return text:reverse()
|
||||
end
|
||||
|
||||
--- Splits string into a list of UTF-8 characters.
|
||||
---- @string text the string to be split.
|
||||
|
||||
Reference in New Issue
Block a user