diff --git a/nel/samples/misc/i18n/main.cpp b/nel/samples/misc/i18n/main.cpp index 1c8ddabb9..5456c1325 100644 --- a/nel/samples/misc/i18n/main.cpp +++ b/nel/samples/misc/i18n/main.cpp @@ -44,9 +44,9 @@ int main (int argc, char **argv) // load the language CI18N::load(langName); - InfoLog->displayRawNL(CI18N::get("Hi").toString().c_str()); - InfoLog->displayRawNL(CI18N::get("PresentI18N").toString().c_str(), "Nevrax"); - InfoLog->displayRawNL(CI18N::get("ExitStr").toString().c_str()); + InfoLog->displayRawNL(CI18N::get("Hi").c_str()); + InfoLog->displayRawNL(CI18N::get("PresentI18N").c_str(), "Nevrax"); + InfoLog->displayRawNL(CI18N::get("ExitStr").c_str()); getchar(); return EXIT_SUCCESS; diff --git a/nel/src/misc/unicode.cpp b/nel/src/misc/unicode.cpp index d28a7c56e..c6780db54 100644 --- a/nel/src/misc/unicode.cpp +++ b/nel/src/misc/unicode.cpp @@ -4731,10 +4731,13 @@ NL_FORCE_INLINE void appendToLowerAsUtf8(std::string &res, const char *str, ptrd { char c = str[i]; char d, e; - if (c >= 'A' && c <= 'Z') + if (c < 0x80) { - // 1-byte UTF-8 - c += 'a' - 'A'; + if (c >= 'A' && c <= 'Z') + { + // 1-byte UTF-8 + c += 'a' - 'A'; + } } else if ((c & 0xE0) == 0xC0 && ((d = str[i + 1]) & 0xC0) == 0x80) { @@ -4803,10 +4806,13 @@ NL_FORCE_INLINE void appendToUpperAsUtf8(std::string &res, const char *str, ptrd { char c = str[i]; char d, e; - if (c >= 'a' && c <= 'z') + if (c < 0x80) { - // 1-byte UTF-8 - c -= 'a' - 'A'; + if (c >= 'a' && c <= 'z') + { + // 1-byte UTF-8 + c -= 'a' - 'A'; + } } else if ((c & 0xE0) == 0xC0 && ((d = str[i + 1]) & 0xC0) == 0x80) { diff --git a/nel/src/misc/utf_string_view.cpp b/nel/src/misc/utf_string_view.cpp index 9f4057b66..06dcb5e76 100644 --- a/nel/src/misc/utf_string_view.cpp +++ b/nel/src/misc/utf_string_view.cpp @@ -72,7 +72,7 @@ std::string CUtfStringView::toUtf8(bool reEncode) const return std::string((const char *)m_Str, (const char *)((ptrdiff_t)m_Str + m_Size)); std::string res; res.reserve(m_Size); - for (iterator it(begin()), end(end()); it != end; ++it) + for (iterator it(begin()), end(this->end()); it != end; ++it) { appendUtf8(res, *it); } @@ -85,7 +85,7 @@ ucstring CUtfStringView::toUtf16(bool reEncode) const return ucstring((const ucchar *)m_Str, (const ucchar *)((ptrdiff_t)m_Str + m_Size)); ucstring res; res.reserve(m_Size << 1); - for (iterator it(begin()), end(end()); it != end; ++it) + for (iterator it(begin()), end(this->end()); it != end; ++it) { u32char c = *it; if (c < 0x10000) @@ -110,7 +110,7 @@ u32string CUtfStringView::toUtf32() const return u32string((const u32char *)m_Str, (const u32char *)((ptrdiff_t)m_Str + m_Size)); u32string res; res.reserve(m_Size << 2); - for (iterator it(begin()), end(end()); it != end; ++it) + for (iterator it(begin()), end(this->end()); it != end; ++it) res += *it; return res; } @@ -119,7 +119,7 @@ std::string CUtfStringView::toAscii() const { std::string res; res.reserve(m_Size); - for (iterator it(begin()), end(end()); it != end; ++it) + for (iterator it(begin()), end(this->end()); it != end; ++it) { u32char c = *it; if (c < 0x80) @@ -137,7 +137,7 @@ std::wstring CUtfStringView::toWide() const return std::wstring((const wchar_t *)m_Str, (const wchar_t *)((ptrdiff_t)m_Str + m_Size)); std::wstring res; res.reserve(m_Size << 1); - for (iterator it(begin()), end(end()); it != end; ++it) + for (iterator it(begin()), end(this->end()); it != end; ++it) { u32char c = *it; if (c < 0x10000) @@ -157,7 +157,7 @@ std::wstring CUtfStringView::toWide() const return std::wstring((const wchar_t *)m_Str, (const wchar_t *)((ptrdiff_t)m_Str + m_Size)); std::wstring res; res.reserve(m_Size << 2); - for (iterator it(begin()), end(end()); it != end; ++it) + for (iterator it(begin()), end(this->end()); it != end; ++it) res += *it; return res; #endif @@ -166,7 +166,7 @@ std::wstring CUtfStringView::toWide() const size_t CUtfStringView::count() const { size_t res = 0; - for (iterator it(begin()), end(end()); it != end; ++it) + for (iterator it(begin()), end(this->end()); it != end; ++it) ++res; return res; } diff --git a/ryzom/client/src/string_manager_client.h b/ryzom/client/src/string_manager_client.h index 021d9f433..c553f7c57 100644 --- a/ryzom/client/src/string_manager_client.h +++ b/ryzom/client/src/string_manager_client.h @@ -60,7 +60,7 @@ public: // Force the cache to be saved void flushStringCache(); - bool getString(uint32 stringId, std::string &result) { ucstring temp; getString(stringId, temp); result = temp.toUtf8(); } // FIXME: UTF-8 + bool getString(uint32 stringId, std::string &result) { ucstring temp; bool res = getString(stringId, temp); result = temp.toUtf8(); return res; } // FIXME: UTF-8 bool getString(uint32 stringId, ucstring &result); void waitString(uint32 stringId, const IStringWaiterRemover *premover, ucstring *result); void waitString(uint32 stringId, IStringWaitCallback *pcallback);