-
Notifications
You must be signed in to change notification settings - Fork 38
Description
Hello
I've noticed a recurring visual bug with the BCDM (CastBar) addon where certain spells (especially in French or with special names) show a "square box" instead of an apostrophe.
The Cause: The WoW API often returns "smart" or typographic quotes (like ’ or ‘) instead of the standard straight apostrophe ('). Many custom fonts used in UI packs don't include these specific glyphs, resulting in the "missing character" box.
The Solution: I've worked on a fix for CastBar.lua by implementing a sanitization function that replaces these characters before they are sent to the FontString.
Changes made:
Added a SanitizeText helper function.
Applied the function to UnitCastingInfo and UnitChannelInfo within the UpdateCastBarValues logic.
local function SanitizeText(text)
if not text then return "" end
-- Replaces curly/typographic quotes with a standard straight apostrophe
text = text:gsub("’", "'"):gsub("‘", "'"):gsub("`", "'")
return text
end
-- Example of application:
local name = UnitCastingInfo("player")
BCDM.CastBar.SpellNameText:SetText(string.sub(SanitizeText(name), 1, BCDM.db.profile.CastBar.Text.SpellName.MaxCharacters))
I'm not a coder myself, so I used Gemini to help me identify the technical cause and write this specific Lua fix.