summaryrefslogtreecommitdiffstats
path: root/sys/libkern
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2014-06-09 19:27:47 +0000
committerjhb <jhb@FreeBSD.org>2014-06-09 19:27:47 +0000
commit7a3f5808a0fc3d8b7a9ac66e88e07c9290ee6b29 (patch)
tree27fe5daedd7a6759fb584b92f4f0f8c4de120f2b /sys/libkern
parent60d32b5d2dd5ce26647c12a5976766258c3dc2ba (diff)
downloadFreeBSD-src-7a3f5808a0fc3d8b7a9ac66e88e07c9290ee6b29.zip
FreeBSD-src-7a3f5808a0fc3d8b7a9ac66e88e07c9290ee6b29.tar.gz
Use strcasecmp() instead of strcmp() when checking user-supplied encoding
names so that encoding names are treated as case-insensitive. This allows the use of 'utf-8' instead of 'UTF-8' for example and matches the behavior of iconv(1). PR: 167977 Submitted by: buganini@gmail.com MFC after: 1 week
Diffstat (limited to 'sys/libkern')
-rw-r--r--sys/libkern/iconv.c4
-rw-r--r--sys/libkern/iconv_ucs.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/libkern/iconv.c b/sys/libkern/iconv.c
index 0b92047..b42c043 100644
--- a/sys/libkern/iconv.c
+++ b/sys/libkern/iconv.c
@@ -168,8 +168,8 @@ iconv_lookupcs(const char *to, const char *from, struct iconv_cspair **cspp)
struct iconv_cspair *csp;
TAILQ_FOREACH(csp, &iconv_cslist, cp_link) {
- if (strcmp(csp->cp_to, to) == 0 &&
- strcmp(csp->cp_from, from) == 0) {
+ if (strcasecmp(csp->cp_to, to) == 0 &&
+ strcasecmp(csp->cp_from, from) == 0) {
if (cspp)
*cspp = csp;
return 0;
diff --git a/sys/libkern/iconv_ucs.c b/sys/libkern/iconv_ucs.c
index 30810eb..047436d 100644
--- a/sys/libkern/iconv_ucs.c
+++ b/sys/libkern/iconv_ucs.c
@@ -102,9 +102,9 @@ iconv_ucs_open(struct iconv_converter_class *dcp,
if (cspf)
dp->convtype |= KICONV_UCS_COMBINE;
for (i = 0; unicode_family[i].name; i++) {
- if (strcmp(from, unicode_family[i].name) == 0)
+ if (strcasecmp(from, unicode_family[i].name) == 0)
dp->convtype |= unicode_family[i].from_flag;
- if (strcmp(to, unicode_family[i].name) == 0)
+ if (strcasecmp(to, unicode_family[i].name) == 0)
dp->convtype |= unicode_family[i].to_flag;
}
if (strcmp(ENCODING_UNICODE, ENCODING_UTF16) == 0)
OpenPOWER on IntegriCloud