summaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2006-11-08 15:29:14 +0000
committerSebastien Helleu <flashcode@flashtux.org>2006-11-08 15:29:14 +0000
commit3dcea500739354ff4755dc5c6dc08cab775ec3dd (patch)
tree11159112f92a59a4c016e13d898598be3b7dee38 /src/common/util.c
parent855997623d252428978a05def30ca93bfd11b7a9 (diff)
downloadweechat-3dcea500739354ff4755dc5c6dc08cab775ec3dd.zip
Remove some unneeded iconv calls (for UTF-8 term)
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c14
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, '?');