diff options
author | Marc Laukien <marc@zeroc.com> | 2002-01-17 18:53:26 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2002-01-17 18:53:26 +0000 |
commit | ee96d66cf2a5a5b62b5ac01dbe251ba21e7fae96 (patch) | |
tree | 20e6b7d2611345407074be079cdb9f6f6cb64904 /cpp/src/IceUtil/Unicode.cpp | |
parent | Fix bug with location of annotation for some types. (diff) | |
download | ice-ee96d66cf2a5a5b62b5ac01dbe251ba21e7fae96.tar.bz2 ice-ee96d66cf2a5a5b62b5ac01dbe251ba21e7fae96.tar.xz ice-ee96d66cf2a5a5b62b5ac01dbe251ba21e7fae96.zip |
unicode tests
Diffstat (limited to 'cpp/src/IceUtil/Unicode.cpp')
-rw-r--r-- | cpp/src/IceUtil/Unicode.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/cpp/src/IceUtil/Unicode.cpp b/cpp/src/IceUtil/Unicode.cpp index cf996046645..3850193b76a 100644 --- a/cpp/src/IceUtil/Unicode.cpp +++ b/cpp/src/IceUtil/Unicode.cpp @@ -9,6 +9,7 @@ // ********************************************************************** #include <IceUtil/Unicode.h> +#include <algorithm> using namespace std; @@ -20,8 +21,9 @@ IceUtil::wstringToString(const wstring& str) for (unsigned int i = 0; i < str.length(); ++i) { - wchar_t wc = str[i]; - + wchar_t wc; + wc = str[i]; + if (wc < 0x80) { result += static_cast<char>(wc); @@ -110,7 +112,7 @@ IceUtil::stringToWstring(const string& str) if (i + len - 1 < str.length()) { - for (unsigned int j = 1; j < len - 1; ++j) + for (unsigned int j = 1; j < len; ++j) { if ((str[i + j] & 0xc0) != 0x80) // All other bytes must be 10xxxxxx { @@ -120,6 +122,8 @@ IceUtil::stringToWstring(const string& str) wc <<= 6; wc |= str[i + j] & 0x3f; } + + result += wc; } else { |