diff options
Diffstat (limited to 'src/common/util.c')
-rw-r--r-- | src/common/util.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/common/util.c b/src/common/util.c index aea6b03ea..96ebc835b 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -269,8 +269,14 @@ char * weechat_iconv_to_internal (char *charset, char *string) { char *input, *output; - + input = strdup (string); + + /* optimize for UTF-8: if charset is NULL => we use term charset => + if ths charset is already UTF-8, then no iconv needed */ + if (local_utf8 && (!charset || !charset[0])) + return input; + if (input) { if (utf8_is_valid (input, NULL)) @@ -298,6 +304,12 @@ weechat_iconv_from_internal (char *charset, char *string) char *input, *output; input = strdup (string); + + /* optimize for UTF-8: if charset is NULL => we use term charset => + if ths charset is already UTF-8, then no iconv needed */ + if (local_utf8 && (!charset || !charset[0])) + return input; + if (input) { utf8_normalize (input, '?'); |