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