Don't fail when locale env. vars specify a dot-less locale name.

Fixes <http://bugs.gnu.org/10742>.
Reported by Alírio Eyng <alirioeyng@ig.com.br>.

* gnulib-local/lib/localcharset.c.diff (environ_locale_charset): Change
  to set CODESET to "" when LOCALE lacks a dot.  Return "ISO-8859-1"
  when CODESET is the empty string.

* lib/localcharset.c: Update.

* test-suite/standalone/Makefile.am (check_SCRIPTS): Add
  `test-command-line-encoding2'.
  (TESTS): Likewise.

* test-suite/standalone/test-command-line-encoding2: New file.
This commit is contained in:
Ludovic Courtès 2012-02-18 00:04:17 +01:00
commit 5de0053178
4 changed files with 52 additions and 32 deletions

View file

@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in.
##
## Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
## 2011 Free Software Foundation, Inc.
## 2011, 2012 Free Software Foundation, Inc.
##
## This file is part of GUILE.
##
@ -85,6 +85,9 @@ EXTRA_DIST += test-import-order-a.scm test-import-order-b.scm \
check_SCRIPTS += test-command-line-encoding
TESTS += test-command-line-encoding
check_SCRIPTS += test-command-line-encoding2
TESTS += test-command-line-encoding2
# test-num2integral
test_num2integral_SOURCES = test-num2integral.c
test_num2integral_CFLAGS = ${test_cflags}

View file

@ -0,0 +1,20 @@
#!/bin/sh
# Choose a locale name that lacks a dot followed by the encoding name.
# This should not confuse `environ_locale_charset'.
# See <http://bugs.gnu.org/10742> for the original bug report.
LC_ALL="en_US"
export LC_ALL
unset LANG
unset LC_CTYPE
exec guile -q -s "$0" "hello"
!#
;; Make sure our argument was suitable decoded.
(exit (string=? (cadr (program-arguments)) "hello"))
;; Local Variables:
;; mode: scheme
;; coding: iso-8859-1
;; End: