diff options
Diffstat (limited to 'cpp/src/IceUtil/Unicode.cpp')
-rw-r--r-- | cpp/src/IceUtil/Unicode.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/cpp/src/IceUtil/Unicode.cpp b/cpp/src/IceUtil/Unicode.cpp new file mode 100644 index 00000000000..ba298e3b770 --- /dev/null +++ b/cpp/src/IceUtil/Unicode.cpp @@ -0,0 +1,33 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <IceUtil/Unicode.h> + +using namespace std; + +string +IceUtil::wstringToString(const wstring& str) +{ + char* s = new char[str.size() + 1]; + wcstombs(s, str.c_str(), str.size() + 1); + string result(s); + delete [] s; + return result; +} + +wstring +IceUtil::stringToWstring(const string& str) +{ + wchar_t* s = new wchar_t[str.size() + 1]; + mbstowcs(s, str.c_str(), str.size() + 1); + wstring result(s); + delete [] s; + return result; +} |