diff --git a/src/modules/Eluna/GlobalMethods.h b/src/modules/Eluna/GlobalMethods.h index c487576fe..36094c576 100644 --- a/src/modules/Eluna/GlobalMethods.h +++ b/src/modules/Eluna/GlobalMethods.h @@ -8,6 +8,7 @@ #define GLOBALMETHODS_H #include "ElunaBinding.h" +#include "Util.h" /*** * These functions can be used anywhere at any time, including at start-up. diff --git a/src/shared/Utilities/Util.cpp b/src/shared/Utilities/Util.cpp index b28460e16..91b0ac584 100644 --- a/src/shared/Utilities/Util.cpp +++ b/src/shared/Utilities/Util.cpp @@ -375,6 +375,17 @@ void utf8truncate(std::string& utf8str, size_t len) } } +bool Utf8ToUpperOnlyLatin(std::string& utf8String) +{ + std::wstring wstr; + if (!Utf8toWStr(utf8String, wstr)) + return false; + + std::transform(wstr.begin(), wstr.end(), wstr.begin(), wcharToUpperOnlyLatin); + + return WStrToUtf8(wstr, utf8String); +} + bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize) { try diff --git a/src/shared/Utilities/Util.h b/src/shared/Utilities/Util.h index 6891c9efd..5ff3c1f86 100644 --- a/src/shared/Utilities/Util.h +++ b/src/shared/Utilities/Util.h @@ -252,6 +252,14 @@ inline void ApplyPercentModFloatVar(float& var, float val, bool apply) var *= (apply ? (100.0f + val) / 100.0f : 100.0f / (100.0f + val)); } +/** + * @brief + * + * @param utf8String + * @return bool + */ +bool Utf8ToUpperOnlyLatin(std::string& utf8String); + /** * @brief *