2 Commits

Author SHA1 Message Date
7d9b30fff2 - additional methods for multibyte UFT8 character detection 2023-06-03 13:43:26 +02:00
396e140102 Version 1.1.6
- bumped version for latest WotLK Classic patch
- updated Ace3.0 libraries for latest WotLK Classic patch
2023-01-18 19:47:41 +01:00
9 changed files with 178 additions and 17 deletions

View File

@@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Version 1.1.7 - 2022-xx-yy
### Fixed
- handling of german umlauts (and other unicode characters)
## Version 1.1.6 - 2023-01-18
### Changed
- bumped version for latest WotLK Classic patch
### Fixed
- updated Ace3.0 libraries for latest WotLK Classic patch
## Version 1.1.5 - 2022-12-04
### Fixed
- updated Ace3 libraries for Dragonflight

View File

@@ -3,13 +3,13 @@
## Title: Grichelde
## Notes: Replaces characters of your chat input line before sending.
## Notes-de: Ersetzt eingegebene Zeichen in der Chat-Zeile vor dem Versenden.
## Version: 1.1.5
## Version: 1.1.6
## Author: Teilzeit-Jedi
## eMail: tj@teilzeit-jedi.de
## X-Build: Retail
## X-Compatible: 11403
## X-Compatible: 30400
## X-Compatible: 30401
## X-Curse-Project-ID: 385480
## X-License: GPLv3

View File

@@ -287,6 +287,97 @@ local function getNextCharUtf8(word)
end
end
local function isUtf8MultiByte(word)
return Grichelde.F.length(word) ~= Grichelde.F.lengthUtf8(word)
end
local function getUtf8Sequence(word)
if ((word == nil) or (Grichelde.F.type(word) ~= "string") or (Grichelde.F.lengthUtf8(word) ~= 1)) then
return nil
end
--[[
You could use the following code snippet to iterate over UTF-8 sequences
(this will simply skip over most invalid codes):
for uchar in string.gmatch(ustring, "([%z\1-\127\194-\244][\128-\191]*)") do
...
end
]]--
local sequence = "%z"
local c1 = Grichelde.F.toByte(word, 1)
sequence = sequence .. "\\" .. c1
if (c1 > 0) and (c1 <= 127) then
-- UTF8-1
return sequence
end
local c2 = Grichelde.F.toByte(word, 2)
sequence = sequence .. "\\" .. c2
if (c1 >= 194) and (c1 <= 223) then
-- UTF8-2
return sequence
end
local c3 = Grichelde.F.toByte(word, 3)
sequence = sequence .. "\\" .. c3
if (c1 >= 224) and (c1 <= 239) then
-- UTF8-3
return sequence
end
local c4 = Grichelde.F.toByte(word, 4)
sequence = sequence .. "\\" .. c4
if (c1 >= 240) and (c1 <= 244) then
-- UTF8-4
return sequence
end
return nil
end
local function getUtf8Table(word)
if ((word == nil) or (Grichelde.F.type(word) ~= "string") or (Grichelde.F.lengthUtf8(word) ~= 1)) then
return nil
end
--[[
You could use the following code snippet to iterate over UTF-8 sequences
(this will simply skip over most invalid codes):
for uchar in string.gmatch(ustring, "([%z\1-\127\194-\244][\128-\191]*)") do
...
end
]]--
local tbl = {}
local c1 = Grichelde.F.toByte(word, 1)
Grichelde.F.tInsert(tbl, "%z\\" .. c1)
local c2 = Grichelde.F.toByte(word, 2)
if (c1 >= 194) and (c1 <= 223) then
-- UTF8-2
Grichelde.F.tInsert(tbl, "\\" .. c2)
end
local c3 = Grichelde.F.toByte(word, 3)
if (c1 >= 224) and (c1 <= 239) then
-- UTF8-3
Grichelde.F.tInsert(tbl, "\\" .. c3)
end
local c4 = Grichelde.F.toByte(word, 4)
if (c1 >= 240) and (c1 <= 244) then
-- UTF8-4
Grichelde.F.tInsert(tbl, "\\" .. c4)
end
return tbl
end
local function isLetter(word)
local char = Grichelde.F.getNextCharUtf8(word)
return (char ~= nil) and (Grichelde.F.toUpper(char) ~= Grichelde.F.toLower(char))
@@ -418,6 +509,9 @@ Grichelde.F = {
toUpper = _G.strupper,
toLower = _G.strlower,
getNextCharUtf8 = getNextCharUtf8,
isUtf8MultiByte = isUtf8MultiByte,
getUtf8Sequence = getUtf8Sequence,
getUtf8Table = getUtf8Table,
isLetter = isLetter,
isNumber = isNumber,
isUpper = isUpper,

View File

@@ -72,7 +72,7 @@ function Grichelde:RunTests()
["OSSO"] = "OCHO",
["ooSS"] = "ooCH",
["schmeissen"] = "chmeichen",
["Schön"] = "Chön",
["Sch&#246;n"] = "Chön",
}
)
ok = ok + o
@@ -776,6 +776,56 @@ function Grichelde:RunTests()
ok = ok + o
all = all + a
o, a = test(
"umlauts",
{
replacement_10 = {
order = 10,
searchText = "ä",
replaceText = "ae",
exactCase = false,
consolidate = false,
matchWhen = 2,
stopOnMatch = false,
},
replacement_11 = {
order = 11,
searchText = "ö",
replaceText = "oe",
exactCase = false,
consolidate = false,
matchWhen = 2,
stopOnMatch = false,
},
replacement_12 = {
order = 12,
searchText = "ü",
replaceText = "ue",
exactCase = false,
consolidate = false,
matchWhen = 2,
stopOnMatch = false,
},
replacement_13 = {
order = 13,
searchText = "ß",
replaceText = "ss",
exactCase = false,
consolidate = false,
matchWhen = 2,
stopOnMatch = false,
},
},
{
["Hallä"] = "Hallae",
["Ätsch"] = "Aetsch",
["Hällöleü"] = "Haelloeleue",
["ÜöÄ"] = "UeoeAe",
}
)
ok = ok + o
all = all + a
if (ok == all) then
self:PrefixedPrint("All %d tests %s", all, cGreen("passed"))
else

View File

@@ -3,12 +3,12 @@
## Title: Grichelde
## Notes: Replaces characters of your chat input line before sending.
## Notes-de: Ersetzt eingegebene Zeichen in der Chat-Zeile vor dem Versenden.
## Version: 1.1.5
## Version: 1.1.6
## Author: Teilzeit-Jedi
## eMail: tj@teilzeit-jedi.de
## X-Build: Classic
## X-Compatible: 30400
## X-Compatible: 30401
## X-Compatible: 100002
## X-Curse-Project-ID: 385480
@@ -45,3 +45,5 @@ GricheldeUpgrade.lua
GricheldeOptions.lua
GricheldeMinimap.lua
GricheldeChat.lua
GricheldeTest.lua

View File

@@ -1,9 +1,9 @@
## Interface: 30400
## Interface: 30401
## Title: Grichelde
## Notes: Replaces characters of your chat input line before sending.
## Notes-de: Ersetzt eingegebene Zeichen in der Chat-Zeile vor dem Versenden.
## Version: 1.1.5
## Version: 1.1.6
## Author: Teilzeit-Jedi
## eMail: tj@teilzeit-jedi.de

View File

@@ -7,7 +7,7 @@ local LibStub = LibStub
local gui = LibStub("AceGUI-3.0")
local reg = LibStub("AceConfigRegistry-3.0")
local MAJOR, MINOR = "AceConfigDialog-3.0", 85
local MAJOR, MINOR = "AceConfigDialog-3.0", 86
local AceConfigDialog, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
if not AceConfigDialog then return end
@@ -147,6 +147,7 @@ local stringIsLiteral = {
width = true,
image = true,
fontSize = true,
tooltipHyperlink = true
}
--Is Never a function or method
@@ -501,6 +502,14 @@ local function OptionOnMouseOver(widget, event)
local tooltip = AceConfigDialog.tooltip
tooltip:SetOwner(widget.frame, "ANCHOR_TOPRIGHT")
local tooltipHyperlink = GetOptionsMemberValue("tooltipHyperlink", opt, options, path, appName)
if tooltipHyperlink then
tooltip:SetHyperlink(tooltipHyperlink)
tooltip:Show()
return
end
local name = GetOptionsMemberValue("name", opt, options, path, appName)
local desc = GetOptionsMemberValue("desc", opt, options, path, appName)
local usage = GetOptionsMemberValue("usage", opt, options, path, appName)

View File

@@ -11,7 +11,7 @@
-- @release $Id$
local CallbackHandler = LibStub("CallbackHandler-1.0")
local MAJOR, MINOR = "AceConfigRegistry-3.0", 20
local MAJOR, MINOR = "AceConfigRegistry-3.0", 21
local AceConfigRegistry = LibStub:NewLibrary(MAJOR, MINOR)
if not AceConfigRegistry then return end
@@ -83,6 +83,7 @@ local basekeys={
dialogHidden=optmethodbool,
dropdownHidden=optmethodbool,
cmdHidden=optmethodbool,
tooltipHyperlink=optstringfunc,
icon=optstringnumberfunc,
iconCoords=optmethodtable,
handler=opttable,

View File

@@ -1,5 +1,5 @@
--[[ $Id$ ]]
local MAJOR, MINOR = "CallbackHandler-1.0", 7
local MAJOR, MINOR = "CallbackHandler-1.0", 8
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)
if not CallbackHandler then return end -- No upgrade needed
@@ -7,21 +7,16 @@ if not CallbackHandler then return end -- No upgrade needed
local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end}
-- Lua APIs
local error = error
local securecallfunction, error = securecallfunction, error
local setmetatable, rawget = setmetatable, rawget
local next, select, pairs, type, tostring = next, select, pairs, type, tostring
local xpcall = xpcall
local function errorhandler(err)
return geterrorhandler()(err)
end
local function Dispatch(handlers, ...)
local index, method = next(handlers)
if not method then return end
repeat
xpcall(method, errorhandler, ...)
securecallfunction(method, ...)
index, method = next(handlers, index)
until not method
end