fix a charset issue

This commit is contained in:
Jinhao 2015-06-17 00:07:20 +08:00
parent 5982f8c7bf
commit e2cf5452d5

View File

@ -799,7 +799,7 @@ namespace nana
switch(utf_x_) switch(utf_x_)
{ {
case unicode::utf8: case unicode::utf8:
#if defined(NANA_MINGW) #if defined(NANA_WINDOWS)
strbuf = detail::utf8_to_utf16(data_, true); strbuf = detail::utf8_to_utf16(data_, true);
detail::put_utf16char(strbuf, 0, true); detail::put_utf16char(strbuf, 0, true);
#else #else
@ -808,7 +808,7 @@ namespace nana
#endif #endif
break; break;
case unicode::utf16: case unicode::utf16:
#if defined(NANA_MINGW) #if defined(NANA_WINDOWS)
strbuf = data_; strbuf = data_;
detail::put_utf16char(strbuf, 0, true); detail::put_utf16char(strbuf, 0, true);
#else #else
@ -817,7 +817,7 @@ namespace nana
#endif #endif
break; break;
case unicode::utf32: case unicode::utf32:
#if defined(NANA_MINGW) #if defined(NANA_WINDOWS)
strbuf = detail::utf32_to_utf16(data_); strbuf = detail::utf32_to_utf16(data_);
detail::put_utf16char(strbuf, 0, true); detail::put_utf16char(strbuf, 0, true);
#else #else
@ -907,21 +907,21 @@ namespace nana
switch(utf_x_) switch(utf_x_)
{ {
case unicode::utf8: case unicode::utf8:
#if defined(NANA_MINGW) #if defined(NANA_WINDOWS)
bytes = detail::utf8_to_utf16(data_, true); bytes = detail::utf8_to_utf16(data_, true);
#else #else
bytes = detail::utf8_to_utf32(data_, true); bytes = detail::utf8_to_utf32(data_, true);
#endif #endif
break; break;
case unicode::utf16: case unicode::utf16:
#if defined(NANA_MINGW) #if defined(NANA_WINDOWS)
bytes = data_; bytes = data_;
#else #else
bytes = detail::utf16_to_utf32(data_); bytes = detail::utf16_to_utf32(data_);
#endif #endif
break; break;
case unicode::utf32: case unicode::utf32:
#if defined(NANA_MINGW) #if defined(NANA_WINDOWS)
bytes = detail::utf32_to_utf16(data_); bytes = detail::utf32_to_utf16(data_);
#else #else
bytes = data_; bytes = data_;
@ -984,19 +984,19 @@ namespace nana
switch(encoding) switch(encoding)
{ {
case unicode::utf8: case unicode::utf8:
#if defined(NANA_MINGW) #if defined(NANA_WINDOWS)
return detail::utf16_to_utf8(std::string(reinterpret_cast<const char*>(data_.c_str()), data_.size() * sizeof(wchar_t))); return detail::utf16_to_utf8(std::string(reinterpret_cast<const char*>(data_.c_str()), data_.size() * sizeof(wchar_t)));
#else #else
return detail::utf32_to_utf8(std::string(reinterpret_cast<const char*>(data_.c_str()), data_.size() * sizeof(wchar_t))); return detail::utf32_to_utf8(std::string(reinterpret_cast<const char*>(data_.c_str()), data_.size() * sizeof(wchar_t)));
#endif #endif
case unicode::utf16: case unicode::utf16:
#if defined(NANA_MINGW) #if defined(NANA_WINDOWS)
return std::string(reinterpret_cast<const char*>(data_.c_str()), data_.size() * sizeof(wchar_t)); return std::string(reinterpret_cast<const char*>(data_.c_str()), data_.size() * sizeof(wchar_t));
#else #else
return detail::utf32_to_utf16(std::string(reinterpret_cast<const char*>(data_.c_str()), data_.size() * sizeof(wchar_t))); return detail::utf32_to_utf16(std::string(reinterpret_cast<const char*>(data_.c_str()), data_.size() * sizeof(wchar_t)));
#endif #endif
case unicode::utf32: case unicode::utf32:
#if defined(NANA_MINGW) #if defined(NANA_WINDOWS)
return detail::utf16_to_utf32(std::string(reinterpret_cast<const char*>(data_.c_str()), data_.size() * sizeof(wchar_t))); return detail::utf16_to_utf32(std::string(reinterpret_cast<const char*>(data_.c_str()), data_.size() * sizeof(wchar_t)));
#else #else
return std::string(reinterpret_cast<const char*>(data_.c_str()), data_.size() * sizeof(wchar_t)); return std::string(reinterpret_cast<const char*>(data_.c_str()), data_.size() * sizeof(wchar_t));