From 2b12019b79fa9288d95eb3f151ff6b9ff9526002 Mon Sep 17 00:00:00 2001 From: DelaneDiamon Date: Sun, 19 Oct 2025 00:50:03 -0700 Subject: [PATCH] Fix UTF-8 fallback for abbreviated names --- modules/tags.lua | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/modules/tags.lua b/modules/tags.lua index a6fed25f..8c17bc92 100755 --- a/modules/tags.lua +++ b/modules/tags.lua @@ -370,7 +370,24 @@ end -- Name abbreviation local function abbreviateName(text) - return (string.utf8sub or string.sub)(text, 1, 1) .. "." + if not text or text == "" then + return "." + end + + if utf8sub then + -- Use Blizzard's UTF-8 safe substring helper when available + local first = utf8sub(text, 1, 1) + if first and first ~= "" then + return first .. "." + end + end + + local first = string.match(text, "[%z\1-\127\194-\244][\128-\191]*") + if not first or first == "" then + first = string.sub(text, 1, 1) + end + + return first .. "." end Tags.abbrevCache = setmetatable({}, {