From ed5a93caad08489d1c69cdd324eaed7e3728dc90 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Tue, 28 Jun 2005 23:46:16 +0000 Subject: [PATCH] [project @ 2005-06-28 23:46:16 by jmb] Using Iconv to convert between an encoding and itself is pretty pointless. svn path=/import/netsurf/; revision=1772 --- utils/utf8.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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);