]> mj.ucw.cz Git - libucw.git/blobdiff - charset/setnames.c
XTypes: Fixed dump of configuration.
[libucw.git] / charset / setnames.c
index 9c888828ff6711322e84ec12310606134c2391ae..3f4cdda67bf6274bed957275ae380535be58700a 100644 (file)
@@ -2,17 +2,20 @@
  *     Character Set Conversion Library 1.0 -- Character Set Names
  *
  *     (c) 1998--2005 Martin Mares <mj@ucw.cz>
  *     Character Set Conversion Library 1.0 -- Character Set Names
  *
  *     (c) 1998--2005 Martin Mares <mj@ucw.cz>
+ *     (c) 2007 Pavel Charvat <pchar@ucw.cz>
  *
  *     This software may be freely distributed and used according to the terms
  *     of the GNU General Public License.
  */
 
  *
  *     This software may be freely distributed and used according to the terms
  *     of the GNU General Public License.
  */
 
-#include "lib/lib.h"
-#include "charset/charconv.h"
+#include <ucw/lib.h>
+#include <charset/charconv.h>
 
 #include <string.h>
 
 
 #include <string.h>
 
-static char *cs_names[] = {
+/* Names according to RFC 1345 (see http://www.iana.org/assignments/character-sets) */
+
+static const char *cs_names[] = {
        "US-ASCII",
        "ISO-8859-1",
        "ISO-8859-2",
        "US-ASCII",
        "ISO-8859-1",
        "ISO-8859-2",
@@ -37,13 +40,15 @@ static char *cs_names[] = {
        "cp852",
        "x-mac-ce",
        "x-cork",
        "cp852",
        "x-mac-ce",
        "x-cork",
-       "utf-8"
+       "utf-8",
+       "utf-16be",
+       "utf-16le"
 };
 
 int
 };
 
 int
-find_charset_by_name(char *c)
+find_charset_by_name(const char *c)
 {
 {
-       unsigned int i;
+       uint i;
 
        for(i=0; i<CONV_NUM_CHARSETS; i++)
                if (!strcasecmp(cs_names[i], c))
 
        for(i=0; i<CONV_NUM_CHARSETS; i++)
                if (!strcasecmp(cs_names[i], c))
@@ -57,5 +62,5 @@ charset_name(int i)
   if (i < 0 || i > CONV_NUM_CHARSETS)
     return "x-unknown";
   else
   if (i < 0 || i > CONV_NUM_CHARSETS)
     return "x-unknown";
   else
-    return cs_names[i];
+    return (char *)cs_names[i];
 }
 }