Commit 2ae73cb3 authored by Mickaël Turnel's avatar Mickaël Turnel

Changed charset conversion function from 'any to any' to 'any to utf8'

Update bctoolbox for this commit to work
parent a9233ebd
...@@ -129,7 +129,7 @@ namespace Utils { ...@@ -129,7 +129,7 @@ namespace Utils {
LINPHONE_PUBLIC std::string localeToUtf8 (const std::string &str); LINPHONE_PUBLIC std::string localeToUtf8 (const std::string &str);
LINPHONE_PUBLIC std::string utf8ToLocale (const std::string &str); LINPHONE_PUBLIC std::string utf8ToLocale (const std::string &str);
LINPHONE_PUBLIC std::string convertString (const std::string &str, const std::string &from, const std::string &to); LINPHONE_PUBLIC std::string convertAnyToUtf8 (const std::string &str, const std::string &encoding);
} }
LINPHONE_END_NAMESPACE LINPHONE_END_NAMESPACE
......
...@@ -457,7 +457,7 @@ static void forceUtf8Content (Content &content) { ...@@ -457,7 +457,7 @@ static void forceUtf8Content (Content &content) {
charset = charset.substr(begin, end - begin); charset = charset.substr(begin, end - begin);
if (Utils::stringToLower(charset) != "utf-8") { if (Utils::stringToLower(charset) != "utf-8") {
string utf8Body = Utils::convertString(content.getBodyAsUtf8String(), charset, "UTF-8"); string utf8Body = Utils::convertAnyToUtf8(content.getBodyAsUtf8String(), charset);
if (!utf8Body.empty()) { if (!utf8Body.empty()) {
// TODO: use move operator if possible in the future! // TODO: use move operator if possible in the future!
content.setBodyFromUtf8(utf8Body); content.setBodyFromUtf8(utf8Body);
......
...@@ -243,8 +243,8 @@ string Utils::utf8ToLocale (const string &str) { ...@@ -243,8 +243,8 @@ string Utils::utf8ToLocale (const string &str) {
return localeStr; return localeStr;
} }
string Utils::convertString (const string &str, const string &from, const string &to) { string Utils::convertAnyToUtf8 (const string &str, const string &encoding) {
char *cStr = bctbx_convert_from_to(str.c_str(), from.c_str(), to.c_str()); char *cStr = bctbx_convert_any_to_utf8(str.c_str(), encoding.c_str());
string convertedStr = cStringToCppString(cStr); string convertedStr = cStringToCppString(cStr);
bctbx_free(cStr); bctbx_free(cStr);
return convertedStr; return convertedStr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment