summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils/utf8.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/utils/utf8.c b/utils/utf8.c
index 3763b3af0..3acf9825a 100644
--- a/utils/utf8.c
+++ b/utils/utf8.c
@@ -248,6 +248,18 @@ utf8_convert_ret utf8_convert(const char *string, size_t len,
assert(string && from && to && result);
+ if (strcasecmp(from, to) == 0) {
+ /* conversion from an encoding to itself == strdup */
+ slen = len ? len : strlen(string);
+ ret = strndup(string, slen);
+ if (!ret)
+ return UTF8_CONVERT_NOMEM;
+
+ *result = ret;
+
+ return UTF8_CONVERT_OK;
+ }
+
in = (char *)string;
cd = iconv_open(to, from);