Blame SOURCES/paps-langinfo.patch

78523c
diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
78523c
--- paps-0.6.8.orig/src/paps.c	2008-09-01 15:07:03.000000000 +0900
78523c
+++ paps-0.6.8/src/paps.c	2008-09-01 15:49:10.000000000 +0900
78523c
@@ -25,6 +25,7 @@
78523c
 #include <pango/pangoft2.h>
78523c
 #include "libpaps.h"
78523c
 #include <errno.h>
78523c
+#include <langinfo.h>
78523c
 #include <stdlib.h>
78523c
 #include <stdio.h>
78523c
 #include <string.h>
78523c
@@ -331,6 +332,9 @@ int main(int argc, char *argv[])
78523c
   GIConv cvh = NULL;
78523c
   GOptionGroup *options;
78523c
 
78523c
+  /* Set locale from environment. */
78523c
+  setlocale(LC_ALL, "");
78523c
+
78523c
   /* Prerequisite when using glib. */
78523c
   g_type_init();
78523c
 
78523c
@@ -480,6 +484,15 @@ int main(int argc, char *argv[])
78523c
   page_layout.scale_x = page_layout.scale_y = 1.0;
78523c
       
78523c
 
78523c
+  if (encoding == NULL)
78523c
+    {
78523c
+      encoding = g_strdup(nl_langinfo(CODESET));
78523c
+      if (!strcmp(encoding, "UTF-8"))
78523c
+        {
78523c
+          g_free(encoding);
78523c
+          encoding = NULL;
78523c
+        }
78523c
+    }
78523c
   if (encoding != NULL)
78523c
     {
78523c
       cvh = g_iconv_open ("UTF-8", encoding);