- fixes german umlauts
This commit is contained in:
+12
-2
@@ -206,6 +206,15 @@ function Grichelde:ReplaceCharacters(text, replName, replTable, consolidate, rep
|
||||
p, patRest = getNextCharUtf8(patRest)
|
||||
end
|
||||
ciPattern = ciPattern .. "]"
|
||||
elseif (isUtf8MultiByte(p)) then
|
||||
-- a set like [Ää] would match single bytes, so only group the differing last byte
|
||||
local upperP, lowerP = toUpper(p), toLower(p)
|
||||
local lead = sub(p, 1, -2)
|
||||
if (upperP ~= lowerP) and (sub(upperP, 1, -2) == lead) and (sub(lowerP, 1, -2) == lead) then
|
||||
ciPattern = ciPattern .. lead .. "[" .. sub(upperP, -1) .. sub(lowerP, -1) .. "]"
|
||||
else
|
||||
ciPattern = ciPattern .. p
|
||||
end
|
||||
else
|
||||
ciPattern = ciPattern .. "[" .. convertToCaseInsensitivePatternGroup(p) .. "]"
|
||||
end
|
||||
@@ -428,8 +437,9 @@ function Grichelde:ReplaceCharacters(text, replName, replTable, consolidate, rep
|
||||
end
|
||||
|
||||
-- update previous consolidate markers
|
||||
local diff = lengthUtf8(replText) - lengthUtf8(match)
|
||||
self:TracePrint("ReplaceCharacters : diff = %d - %d", lengthUtf8(replText), lengthUtf8(match))
|
||||
-- positions are byte offsets, so the difference must be counted in bytes as well
|
||||
local diff = length(replText) - length(match)
|
||||
self:TracePrint("ReplaceCharacters : diff = %d - %d", length(replText), length(match))
|
||||
for key, posList in pairs(consolidate) do
|
||||
if (key ~= replName) then
|
||||
for i, pc in ipairs(posList) do
|
||||
|
||||
Reference in New Issue
Block a user