Fix folder path truncation in filemanager with utf8 chars (#3599)

This commit is contained in:
Robert
2018-01-14 00:05:05 +01:00
committed by poire-z
parent d163f8281d
commit d5d12998f6
2 changed files with 12 additions and 6 deletions

View File

@@ -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.