From: Perl 5 Porters Date: Mon, 8 Jan 1996 09:00:19 +0000 (+0000) Subject: More robust i18nl14n() function from jhi. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=37b42002e388d000fa8e50e1bd4503f5c47c393f;p=p5sagit%2Fp5-mst-13.2.git More robust i18nl14n() function from jhi. --- diff --git a/miniperlmain.c b/miniperlmain.c index 95e9c49..9f3e1d6 100644 --- a/miniperlmain.c +++ b/miniperlmain.c @@ -19,23 +19,25 @@ extern "C" { static void xs_init _((void)); static PerlInterpreter *my_perl; -int +void i18nl14n() { char * lang = getenv("LANG"); #if defined(HAS_SETLOCALE) && defined(LC_CTYPE) { + char * lc_all = getenv("LC_ALL"); char * lc_ctype = getenv("LC_CTYPE"); int i; - if (setlocale(LC_CTYPE, "") == NULL && (lc_ctype || lang)) { + if (setlocale(LC_CTYPE, "") == NULL && (lc_all || lc_ctype || lang)) { + fprintf(stderr, "warning: setlocale(LC_CTYPE, \"\") failed.\n"); fprintf(stderr, - "warning: setlocale(LC_CTYPE, \"\") failed, LC_CTYPE = \"%s\", LANG = \"%s\",\n", + "warning: LC_ALL = \"%s\", LC_CTYPE = \"%s\", LANG = \"%s\",\n", + lc_all ? lc_all : "(null)", lc_ctype ? lc_ctype : "(null)", lang ? lang : "(null)" ); - fprintf(stderr, - "warning: falling back to the \"C\" locale.\n"); + fprintf(stderr, "warning: falling back to the \"C\" locale.\n"); setlocale(LC_CTYPE, "C"); }