From 0d8dceea4310fde5706b3ce1c70609d72a38efdf Mon Sep 17 00:00:00 2001 From: John Schoenick Date: Wed, 9 Sep 2015 18:35:41 -0700 Subject: Updated the SDK with the latest code from the TF and HL2 branches. --- mp/src/tier1/ilocalize.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mp/src/tier1/ilocalize.cpp') diff --git a/mp/src/tier1/ilocalize.cpp b/mp/src/tier1/ilocalize.cpp index d95bbf29..66673e64 100644 --- a/mp/src/tier1/ilocalize.cpp +++ b/mp/src/tier1/ilocalize.cpp @@ -17,7 +17,8 @@ int ILocalize::ConvertANSIToUnicode(const char *ansi, wchar_t *unicode, int unicodeBufferSizeInBytes) { #ifdef POSIX - return Q_UTF8ToUnicode(ansi, unicode, unicodeBufferSizeInBytes); + // Q_UTF8ToUnicode returns the number of bytes. This function is expected to return the number of chars. + return Q_UTF8ToUnicode(ansi, unicode, unicodeBufferSizeInBytes) / sizeof( wchar_t ); #else int chars = MultiByteToWideChar(CP_UTF8, 0, ansi, -1, unicode, unicodeBufferSizeInBytes / sizeof(wchar_t)); unicode[(unicodeBufferSizeInBytes / sizeof(wchar_t)) - 1] = 0; @@ -256,4 +257,4 @@ void ILocalize::ConstructStringKeyValuesInternal(char *unicodeOutput, int unicod void ILocalize::ConstructStringKeyValuesInternal(wchar_t *unicodeOutput, int unicodeBufferSizeInBytes, const wchar_t *formatString, KeyValues *localizationVariables) { ConstructStringKeyValuesInternal_Impl( unicodeOutput, unicodeBufferSizeInBytes, formatString, localizationVariables ); -} \ No newline at end of file +} -- cgit v1.2.3