[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
This commit is contained in:
John Mark Bell 2005-06-28 23:46:16 +00:00
parent f2799e1058
commit ed5a93caad
1 changed files with 12 additions and 0 deletions

View File

@ -248,6 +248,18 @@ utf8_convert_ret utf8_convert(const char *string, size_t len,
assert(string && from && to && result); 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; in = (char *)string;
cd = iconv_open(to, from); cd = iconv_open(to, from);