aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2014-12-30 23:51:30 -0800
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2014-12-30 23:51:30 -0800
commit780f989be4d2a1a5b2da4483e7da7b4505bb2c07 (patch)
tree204605d30726b6f0530cc1b6f4917ceda6c418fa /src/core
parent397924a9103d44a21fb61fe6c275e11551a285f2 (diff)
ICU uses "IMAP-mailbox-name" as charset name.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/basetypes/MCString.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/core/basetypes/MCString.cpp b/src/core/basetypes/MCString.cpp
index 2239363b..2b2a77b7 100644
--- a/src/core/basetypes/MCString.cpp
+++ b/src/core/basetypes/MCString.cpp
@@ -1337,7 +1337,12 @@ void String::appendBytes(const char * bytes, unsigned int length, const char * c
}
#else
UErrorCode err;
-
+
+ // ICU uses "IMAP-mailbox-name" as charset name.
+ if (strcasecmp(charset, "mutf-7") == 0) {
+ charset = "IMAP-mailbox-name";
+ }
+
err = U_ZERO_ERROR;
UConverter * converter = ucnv_open(charset, &err);
if (converter == NULL) {
@@ -2122,13 +2127,18 @@ Data * String::dataUsingEncoding(const char * charset)
UErrorCode err;
Data * data;
+ // ICU uses "IMAP-mailbox-name" as charset name.
+ if (strcasecmp(charset, "mutf-7") == 0) {
+ charset = "IMAP-mailbox-name";
+ }
+
err = U_ZERO_ERROR;
UConverter * converter = ucnv_open(charset, &err);
if (converter == NULL) {
MCLog("invalid charset %s %i", charset, err);
return NULL;
}
-
+
err = U_ZERO_ERROR;
int32_t destLength = ucnv_fromUChars(converter, NULL, 0, mUnicodeChars, mLength, &err);
int32_t destCapacity = destLength + 1;