mirror of
https://github.com/weechat/weechat.git
synced 2026-07-09 03:05:44 +02:00
api: return input string in function string_iconv_from_internal when current locale is wrong
This fixes a bug when writing configuration files with a wrong locale: now UTF-8 is kept and written in files instead of string converted using a wrong charset.
This commit is contained in:
@@ -3253,7 +3253,8 @@ string_iconv_to_internal (const char *charset, const char *string)
|
||||
}
|
||||
|
||||
/*
|
||||
* Converts internal string to terminal charset, for display.
|
||||
* Converts internal string to terminal charset, for display or write of
|
||||
* configuration files.
|
||||
*
|
||||
* Note: result must be freed after use.
|
||||
*/
|
||||
@@ -3270,6 +3271,10 @@ string_iconv_from_internal (const char *charset, const char *string)
|
||||
if (!input)
|
||||
return NULL;
|
||||
|
||||
/* if the locale is wrong, we keep UTF-8 */
|
||||
if (!weechat_locale_ok)
|
||||
return input;
|
||||
|
||||
/*
|
||||
* optimized for UTF-8: if charset is NULL => we use term charset => if
|
||||
* this charset is already UTF-8, then no iconv is needed
|
||||
|
||||
Reference in New Issue
Block a user