diff -Naur enscript-1.6.3.orig/lib/enscript.cfg.in enscript-1.6.3/lib/enscript.cfg.in --- enscript-1.6.3.orig/lib/enscript.cfg.in 2002-08-16 16:35:10 +0400 +++ enscript-1.6.3/lib/enscript.cfg.in 2002-08-16 16:42:00 +0400 @@ -42,7 +42,7 @@ Clean7Bit: 1 # Default input encoding. -DefaultEncoding: latin1 +#DefaultEncoding: latin1 # Default fancy header. DefaultFancyHeader: enscript diff -Naur enscript-1.6.3.orig/src/main.c enscript-1.6.3/src/main.c --- enscript-1.6.3.orig/src/main.c 2002-08-16 16:35:10 +0400 +++ enscript-1.6.3/src/main.c 2002-08-16 16:41:21 +0400 @@ -27,6 +27,8 @@ #include "gsint.h" #include "getopt.h" +#include <langinfo.h> + /* * Prototypes for static functions. */ @@ -923,6 +925,37 @@ }; +char * +locale_to_enscript(char *str){ + int state=-1; + char *tmp = xstrdup(str); + char *p=tmp,*s=str; + + if (!s) return s; + + if (!strncmp(s,"ISO",3)) s+=3; + + for(;*s;s++){ + if (*s!='-'){ + *p=tolower(*s); + p++; + } + } + *p=0; + + return tmp; +} + +char * +system_encoding(){ + char *enc; + char *local_charset=nl_langinfo(CODESET); + if (!local_charset) + return xstrdup("88591"); + else + return locale_to_enscript(local_charset); +} + /* * Global functions. */ @@ -1003,7 +1036,7 @@ /* Defaults for some options. */ media_name = xstrdup ("A4"); - encoding_name = xstrdup ("88591"); + encoding_name = system_encoding();//xstrdup ("88591"); npf_name = xstrdup ("octal"); page_label_format = xstrdup ("short"); ul_style_str = xstrdup ("outline"); @@ -1139,6 +1172,9 @@ /* Personal config. */ (void) read_config (passwd->pw_dir, ".enscriptrc"); +#if 0 + fprintf(stderr,"encoding_name=%s\n",encoding_name); +#endif /* * Options. */