diff options
author | Mark Spruiell <mes@zeroc.com> | 2003-08-12 22:48:22 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2003-08-12 22:48:22 +0000 |
commit | bfd228bed9467a392f1ca0f2fc3487784a8f1f44 (patch) | |
tree | 77556c5184e041db0dc05230eec42e0efc158168 /cpp/src/IceXML/StreamI.cpp | |
parent | Made initialize() more defensive: calling initialize with a null argv is (diff) | |
download | ice-bfd228bed9467a392f1ca0f2fc3487784a8f1f44.tar.bz2 ice-bfd228bed9467a392f1ca0f2fc3487784a8f1f44.tar.xz ice-bfd228bed9467a392f1ca0f2fc3487784a8f1f44.zip |
bug fix for readString - must convert XMLCh to UTF-8
Diffstat (limited to 'cpp/src/IceXML/StreamI.cpp')
-rw-r--r-- | cpp/src/IceXML/StreamI.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/cpp/src/IceXML/StreamI.cpp b/cpp/src/IceXML/StreamI.cpp index 4ae72e53b1c..715d249a820 100644 --- a/cpp/src/IceXML/StreamI.cpp +++ b/cpp/src/IceXML/StreamI.cpp @@ -18,6 +18,7 @@ #include <Ice/LocalException.h> #include <Ice/ObjectFactory.h> #include <IceUtil/InputUtil.h> +#include <IceUtil/Unicode.h> #include <IceXML/StreamI.h> @@ -1010,7 +1011,18 @@ IceXML::StreamI::readString(const string& name) { throw ::Ice::MarshalException(__FILE__, __LINE__); } - value = toString(child->getNodeValue()); + + // + // Convert string to UTF-8. Do NOT use toString() here. + // + const XMLCh* ch = child->getNodeValue(); + unsigned int len = ICE_XERCES_NS XMLString::stringLen(ch); + wstring ws; + for(unsigned int i = 0; i < len; ++i) + { + ws.push_back((wstring::value_type)ch[i]); + } + value = IceUtil::wstringToString(ws); } else { |