aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/basetypes/MCString.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/basetypes/MCString.cc b/src/core/basetypes/MCString.cc
index 3f0338db..3068bc18 100644
--- a/src/core/basetypes/MCString.cc
+++ b/src/core/basetypes/MCString.cc
@@ -1138,7 +1138,16 @@ void String::appendBytes(const char * bytes, unsigned int length, const char * c
if (cfStr != NULL) {
CFDataRef data = CFStringCreateExternalRepresentation(NULL, cfStr, kCFStringEncodingUTF16LE, '_');
if (data != NULL) {
- appendCharactersLength((const UChar *) CFDataGetBytePtr(data), (unsigned int) CFDataGetLength(data) / 2);
+ UChar * fixedData = (UChar *) malloc(CFDataGetLength(data));
+ memcpy(fixedData, CFDataGetBytePtr(data), CFDataGetLength(data));
+ unsigned int length = (unsigned int) CFDataGetLength(data) / 2;
+ for(int32_t i = 0 ; i < length ; i ++) {
+ if (fixedData[i] == 0) {
+ fixedData[i] = ' ';
+ }
+ }
+ appendCharactersLength(fixedData, length);
+ free(fixedData);
CFRelease(data);
}
CFRelease(cfStr);