Silly of me to overlook it: another obvious way you might like to
[sgt/charset] / localenc.c
index d1ce136..f5fabee 100644 (file)
@@ -47,6 +47,11 @@ static const struct {
     { "ISO-8859-16", CS_ISO8859_16, 1 },
     { "CP437", CS_CP437, 1 },
     { "CP850", CS_CP850, 1 },
+    { "CP852", CS_CP852, 1 },
+    { "CP866", CS_CP866, 1 },
+    { "CP874", CS_CP874, 1 },
+    { "Win874", CS_CP874, 0 },
+    { "Win-874", CS_CP874, 0 },
     { "CP1250", CS_CP1250, 1 },
     { "Win1250", CS_CP1250, 0 },
     { "CP1251", CS_CP1251, 1 },
@@ -144,13 +149,15 @@ int charset_from_localenc(const char *name)
        return i;
     if ( (i = charset_from_xenc(name)) != CS_NONE)
        return i;
+    if ( (i = charset_from_emacsenc(name)) != CS_NONE)
+       return i;
 
     for (i = 0; i < (int)lenof(localencs); i++) {
        const char *p, *q;
        p = name;
        q = localencs[i].name;
        while (*p || *q) {
-           if (tolower(*p) != tolower(*q))
+               if (tolower((unsigned char)*p) != tolower((unsigned char)*q))
                break;
            p++; q++;
        }