[uim-commit] r662 - trunk/fep

yamamoto at freedesktop.org yamamoto at freedesktop.org
Tue Feb 15 07:56:56 PST 2005


Author: yamamoto
Date: 2005-02-15 07:56:53 -0800 (Tue, 15 Feb 2005)
New Revision: 662

Modified:
   trunk/fep/str.c
Log:
 * fep/str.c(get_enc): "utf-8" -> "UTF-8", "euc-jp" -> "EUC-JP"


Modified: trunk/fep/str.c
===================================================================
--- trunk/fep/str.c	2005-02-15 15:09:56 UTC (rev 661)
+++ trunk/fep/str.c	2005-02-15 15:56:53 UTC (rev 662)
@@ -72,7 +72,7 @@
     printf("locale not supported\n");
     exit(1);
   }
-  s_utf8 = (strcasecmp(get_enc(), "utf-8") == 0 || strcasecmp(get_enc(), "utf8") == 0);
+  s_utf8 = (strcasecmp(get_enc(), "UTF-8") == 0 || strcasecmp(get_enc(), "UTF8") == 0);
 }
 
 /*
@@ -82,18 +82,15 @@
 const char *get_enc(void)
 {
   const char *locale;
-  if ((locale = getenv("LC_ALL")) ||
-      (locale = getenv("LC_CTYPE")) ||
-      (locale = getenv("LANG")))
-  {
+  if ((locale = setlocale(LC_CTYPE, "")) != NULL) {
     if (strcasecmp(locale, "ja") == 0) {
-      return "euc-jp";
+      return "EUC-JP";
     } else {
       char *ptr = strstr(locale, ".");
-      return ptr != NULL ? ptr + 1 : "utf-8";
+      return ptr != NULL ? ptr + 1 : "UTF-8";
     }
   }
-  return "utf-8";
+  return "UTF-8";
 }
 
 /*



More information about the Uim-commit mailing list