Bug Description
Item names modified by loot filter rules containing ÿc color codes display raw ÿ characters in the message log (Item Drop Notifications / Item Close Notifications), even though the same names render correctly as ground labels.
For example, a Sol rune with decorated filter output like:
%DARK_GREEN%*%GREEN%* Sol %GREEN%12 %GREEN%*%DARK_GREEN%*
Shows correctly on the ground (colored asterisk borders), but in the message log appears as:
Root Cause
In MapNotify.cpp (~line 98), the trim regex only strips leading and trailing color codes:
regex trimName("^\s*(?:(?:\s*?)(ÿc[0123456789;:]))*\s*(.*?\S)\s*(?:ÿc[0123456789;:])*\s*$");
itemName = regex_replace(itemName, trimName, "$1$2");
This has two problems:
-
Interior color codes are never stripped. The regex only matches leading/trailing ÿcX sequences. Color codes embedded within the item name text (e.g., between decorative asterisks and the item name) pass through untouched.
-
MultiByteToWideChar mangles the escape byte. When the name is converted from Windows-1252 to Unicode, the 0xFF color escape byte becomes U+00FF (ÿ), which the message log text renderer does not recognize as a color escape. Every surviving interior ÿcX sequence renders as a visible ÿ glyph.
Suggested Fix
Replace the current leading/trailing-only trim with a global strip of all color codes from the notification text:
// Strip ALL color codes from notification text
std::regex colorCodes("\xFFc[0-9;:\x01-\x1F]");
itemName = std::regex_replace(itemName, colorCodes, "");
Note: the character class [\x01-\x1F] covers the Glide-mode control-character color codes (\x02, \x06, \x07, \x09, \x0C) used by ReplaceGlideDependentColor. The existing ItemDisplay.cpp length-calculation regex at line ~1791 already uses this broader class:
std::regex color_reg("ÿc[0-9;:\x01-\x1F]", std::regex_constants::ECMAScript);
This would strip all color formatting from notification text while leaving ground labels completely unaffected (they use the original name string, not the notification-processed one).
Reproduction
- Use any loot filter with color codes in item display rules (e.g.,
%GREEN%, %DARK_GREEN%, %PURPLE%)
- Enable
Item Drop Notifications: True and/or Item Close Notifications: True in ProjectDiablo.cfg
- Drop or walk near any item whose filter rule embeds color codes in the display name
- Observe
ÿ characters in the message log notification text
Environment
- Project Diablo 2 (Season of Ennui / Hell Unleashed)
- Non-Glide renderer (D2GL)
- Filter: Kassahi-HiimMark S12 Build #178 (affects any filter using color codes in display names)
Bug Description
Item names modified by loot filter rules containing
ÿccolor codes display rawÿcharacters in the message log (Item Drop Notifications / Item Close Notifications), even though the same names render correctly as ground labels.For example, a Sol rune with decorated filter output like:
Shows correctly on the ground (colored asterisk borders), but in the message log appears as:
Root Cause
In
MapNotify.cpp(~line 98), the trim regex only strips leading and trailing color codes:This has two problems:
Interior color codes are never stripped. The regex only matches leading/trailing
ÿcXsequences. Color codes embedded within the item name text (e.g., between decorative asterisks and the item name) pass through untouched.MultiByteToWideCharmangles the escape byte. When the name is converted from Windows-1252 to Unicode, the0xFFcolor escape byte becomesU+00FF(ÿ), which the message log text renderer does not recognize as a color escape. Every surviving interiorÿcXsequence renders as a visibleÿglyph.Suggested Fix
Replace the current leading/trailing-only trim with a global strip of all color codes from the notification text:
Note: the character class
[\x01-\x1F]covers the Glide-mode control-character color codes (\x02,\x06,\x07,\x09,\x0C) used byReplaceGlideDependentColor. The existingItemDisplay.cpplength-calculation regex at line ~1791 already uses this broader class:This would strip all color formatting from notification text while leaving ground labels completely unaffected (they use the original name string, not the notification-processed one).
Reproduction
%GREEN%,%DARK_GREEN%,%PURPLE%)Item Drop Notifications: Trueand/orItem Close Notifications: TrueinProjectDiablo.cfgÿcharacters in the message log notification textEnvironment