I’m working on an application using ImGui for the UI, and I’m having trouble displaying special characters like the Indian Rupee symbol (₹) in my ImGui windows. Currently, these characters are showing up as ?
instead of the correct symbols.I’m specifically using OpenGL as the underlying renderer.
Here’s what I’ve done so far:
-
Loaded a Font: I made sure to load a font that should support special characters.
-
Replacement Function: I have a function that replaces certain placeholder strings with special characters.
I have a function that replaces certain placeholder strings with special characters, including the Indian Rupee symbol. Here’s the function:
std::string workose_studio_replaceSpecialCharacters(const std::string &str) { std::string replacedStr = str; std::map<std::string, std::string> replacements = { {"1397904493", "®"}, {"1397776754", "¶"}, {"1400073811", "§"}, {"1396991858", "°"}, {"1396929140", "©"}, {"1398041963", "™"}, {"1397059140", "–"}, {"1397058884", "—"}, {"1397969521", "’"}, {"1397967985", "‘"}, {"1396986737", """}, {"1397969777", "'"}, {"1397645907", " "}, {"1396984945", "“"}, {"1396986481", "”"}, {"1396862068", "•"}, {"1397518451", "…"}, {"1398320179", "₹"} // Added mapping for the Indian Rupee symbol }; for (const auto &pair : replacements) { size_t pos = replacedStr.find(pair.first); while (pos != std::string::npos) { replacedStr.replace(pos, pair.first.length(), pair.second); pos = replacedStr.find(pair.first, pos + 1); } } return replacedStr; }
Im getting the following result for some special chars enter image description here