Add some GNU libiconv compatibility: Recognize "" and "char" as aliases
authorTor Lillqvist <tml@novell.com>
Thu, 28 Feb 2008 22:59:39 +0000 (22:59 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Thu, 28 Feb 2008 22:59:39 +0000 (22:59 +0000)
2008-02-29  Tor Lillqvist  <tml@novell.com>

* glib/win_iconv.c (name_to_codepage): Add some GNU libiconv
compatibility: Recognize "" and "char" as aliases for the current
locale's charset. (We use the system ANSI codepage as returned by
GetACP().) Recognize "wchar_t" as an alias for UTF-16LE.

svn path=/trunk/; revision=6604

ChangeLog
glib/win_iconv.c

index 50524f6..0ee7d3e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-02-29  Tor Lillqvist  <tml@novell.com>
+
+       * glib/win_iconv.c (name_to_codepage): Add some GNU libiconv
+       compatibility: Recognize "" and "char" as aliases for the current
+       locale's charset. (We use the system ANSI codepage as returned by
+       GetACP().) Recognize "wchar_t" as an alias for UTF-16LE.
+
 2008-02-27  Matthew Barnes  <mbarnes@redhat.com>
 
        * glib/gchecksum.[ch] (g_checksum_update),
index 5cedbcc..b6cbdc0 100644 (file)
@@ -953,7 +953,12 @@ name_to_codepage(const char *name)
 {\r
     int i;\r
 \r
-    if (_strnicmp(name, "cp", 2) == 0)\r
+    if (*name == '\0' ||\r
+       strcmp(name, "char") == 0)\r
+        return GetACP();\r
+    else if (strcmp(name, "wchar_t") == 0)\r
+        return 1200;\r
+    else if (_strnicmp(name, "cp", 2) == 0)\r
         return atoi(name + 2); /* CP123 */\r
     else if ('0' <= name[0] && name[0] <= '9')\r
         return atoi(name);     /* 123 */\r