aboutsummaryrefslogtreecommitdiff
path: root/mp/src/tier1/ilocalize.cpp
diff options
context:
space:
mode:
authorJohn Schoenick <[email protected]>2015-09-09 18:35:41 -0700
committerJohn Schoenick <[email protected]>2015-09-09 18:35:41 -0700
commit0d8dceea4310fde5706b3ce1c70609d72a38efdf (patch)
treec831ef32c2c801a5c5a80401736b52c7b5a528ec /mp/src/tier1/ilocalize.cpp
parentUpdated the SDK with the latest code from the TF and HL2 branches. (diff)
downloadsource-sdk-2013-master.tar.xz
source-sdk-2013-master.zip
Updated the SDK with the latest code from the TF and HL2 branches.HEADmaster
Diffstat (limited to 'mp/src/tier1/ilocalize.cpp')
-rw-r--r--mp/src/tier1/ilocalize.cpp5
1 files changed, 3 insertions, 2 deletions
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<wchar_t>( unicodeOutput, unicodeBufferSizeInBytes, formatString, localizationVariables );
-} \ No newline at end of file
+}