--- ./src/LYMain.c.orig 2006-10-17 21:43:50 +0400 +++ ./src/LYMain.c 2006-10-17 21:45:49 +0400 @@ -52,6 +52,7 @@ #ifdef LOCALE #undef gettext /* Solaris locale.h prototypes gettext() */ #include +#include #ifndef HAVE_GETTEXT #define gettext(s) s #endif @@ -594,6 +595,21 @@ static BOOLEAN LYPrependBase = FALSE; static HTList *LYStdinArgs = NULL; +char *local_language; +char *local_charset; + +char *get_lynx_charset(char *glibc_name){ + char *lynx_name; + + //printf("debug %s\n",glibc_name); + if (!strcmp(glibc_name,"CP1251")){ + lynx_name=strdup("windows-1251"); + }else{ + lynx_name=strdup(glibc_name); + } + return lynx_name; +} + #ifndef EXTENDED_OPTION_LOGIC /* if set then '--' will be recognized as the end of options */ #define EXTENDED_OPTION_LOGIC 1 @@ -1098,7 +1114,13 @@ /* * LOCALE support for international characters. */ - setlocale(LC_ALL, ""); + if (!setlocale(LC_ALL, "")){ + perror("setlocale"); + exit(1); + }else{ + local_language=strdup(setlocale(LC_ALL, "")); + local_charset=nl_langinfo(CODESET); + } #endif /* LOCALE */ /* Set the text message domain. */ #if defined(HAVE_LIBINTL_H) || defined(HAVE_LIBGETTEXT_H) @@ -1550,6 +1572,12 @@ LYReadCFG.c:parse_html_src_spec -HV */ HTSwitchDTD(TRUE); #endif + + local_language[2]=0; + language=strdup(local_language); + pref_charset=strdup(get_lynx_charset(local_charset)); + current_char_set=safeUCGetLYhndl_byMIME(get_lynx_charset(local_charset)); + /* * Process the configuration file. */ @@ -1599,6 +1627,7 @@ /* * Process the RC file. */ + read_rc(NULL); #ifdef EXP_LOCALE_CHARSET