pass to iconv "utf-8" as name of utf8 encoding instead of "utf8"
it seems win32 libiconv doesn't support utf8.
This commit is contained in:
@@ -92,7 +92,7 @@ void utf_to_locale(std::string &s)
|
|||||||
if (s.empty() || Config.system_encoding.empty() || !has_non_ascii_chars(s))
|
if (s.empty() || Config.system_encoding.empty() || !has_non_ascii_chars(s))
|
||||||
return;
|
return;
|
||||||
char *tmp = str_pool_get(s.c_str());
|
char *tmp = str_pool_get(s.c_str());
|
||||||
charset_convert("utf8", Config.system_encoding.c_str(), tmp, s.length());
|
charset_convert("utf-8", Config.system_encoding.c_str(), tmp, s.length());
|
||||||
s = tmp;
|
s = tmp;
|
||||||
str_pool_put(tmp);
|
str_pool_put(tmp);
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ void locale_to_utf(std::string &s)
|
|||||||
if (s.empty() || Config.system_encoding.empty() || !has_non_ascii_chars(s))
|
if (s.empty() || Config.system_encoding.empty() || !has_non_ascii_chars(s))
|
||||||
return;
|
return;
|
||||||
char *tmp = str_pool_get(s.c_str());
|
char *tmp = str_pool_get(s.c_str());
|
||||||
charset_convert(Config.system_encoding.c_str(), "utf8", tmp, s.length());
|
charset_convert(Config.system_encoding.c_str(), "utf-8", tmp, s.length());
|
||||||
s = tmp;
|
s = tmp;
|
||||||
str_pool_put(tmp);
|
str_pool_put(tmp);
|
||||||
}
|
}
|
||||||
@@ -125,14 +125,14 @@ void str_pool_utf_to_locale(char *&s)
|
|||||||
{
|
{
|
||||||
if (!s || Config.system_encoding.empty() || !has_non_ascii_chars(s))
|
if (!s || Config.system_encoding.empty() || !has_non_ascii_chars(s))
|
||||||
return;
|
return;
|
||||||
charset_convert("utf8", Config.system_encoding.c_str(), s);
|
charset_convert("utf-8", Config.system_encoding.c_str(), s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void str_pool_locale_to_utf(char *&s)
|
void str_pool_locale_to_utf(char *&s)
|
||||||
{
|
{
|
||||||
if (!s || Config.system_encoding.empty() || !has_non_ascii_chars(s))
|
if (!s || Config.system_encoding.empty() || !has_non_ascii_chars(s))
|
||||||
return;
|
return;
|
||||||
charset_convert(Config.system_encoding.c_str(), "utf8", s);
|
charset_convert(Config.system_encoding.c_str(), "utf-8", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAVE_ICONV_H
|
#endif // HAVE_ICONV_H
|
||||||
|
|||||||
Reference in New Issue
Block a user