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