summaryrefslogtreecommitdiff
path: root/cpp/src/IceUtil/Unicode.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2016-03-10 09:33:14 +0100
committerJose <jose@zeroc.com>2016-03-10 09:33:14 +0100
commit709f8a26f7ac03bed5a4d1a0b9de6c4e9d14f806 (patch)
tree0665aa227fce4c4c369619fb2ea1d9f718979655 /cpp/src/IceUtil/Unicode.cpp
parentWindows PHP build fixes (diff)
downloadice-709f8a26f7ac03bed5a4d1a0b9de6c4e9d14f806.tar.bz2
ice-709f8a26f7ac03bed5a4d1a0b9de6c4e9d14f806.tar.xz
ice-709f8a26f7ac03bed5a4d1a0b9de6c4e9d14f806.zip
String literals fixes
- Fixed escape sequences in C++ wide strings - Fixed objetive-c escape sequences - Update ruby to use magic comments to set the file encoding
Diffstat (limited to 'cpp/src/IceUtil/Unicode.cpp')
-rw-r--r--cpp/src/IceUtil/Unicode.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/cpp/src/IceUtil/Unicode.cpp b/cpp/src/IceUtil/Unicode.cpp
index 7bad1d67c17..ca36a912b47 100644
--- a/cpp/src/IceUtil/Unicode.cpp
+++ b/cpp/src/IceUtil/Unicode.cpp
@@ -147,6 +147,24 @@ IceUtilInternal::convertUTF8ToUTF16(const vector<unsigned char>& source, vector<
}
ConversionResult
+IceUtilInternal::convertUTF8ToUTF32(const vector<unsigned char>& source, vector<unsigned int>& target, ConversionFlags flags)
+{
+ target.resize(source.size());
+ const unsigned char* sourceStart = &source[0];
+ const unsigned char* sourceEnd = &source[0] + source.size();
+
+ unsigned int* targetStart = &target[0];
+ unsigned int* targetEnd = &target[0] + target.size();
+ ConversionResult result = ConvertUTF8toUTF32(&sourceStart, sourceEnd, &targetStart, targetEnd, flags);
+
+ if(result == conversionOK)
+ {
+ target.resize(targetStart - &target[0]);
+ }
+ return result;
+}
+
+ConversionResult
IceUtilInternal::convertUTF32ToUTF8(const vector<unsigned int>& source, vector<unsigned char>& target, ConversionFlags flags)
{
target.resize(source.size() * 4);