From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Zefram Newsgroups: gmane.lisp.guile.bugs Subject: bug#22902: GUILE_INSTALL_LOCALE not equivalent to setlocale Date: Fri, 4 Mar 2016 03:34:52 +0000 Message-ID: <20160304033452.GB1318@fysh.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1457062578 25638 80.91.229.3 (4 Mar 2016 03:36:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Mar 2016 03:36:18 +0000 (UTC) To: 22902@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Fri Mar 04 04:36:09 2016 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1abgX9-0006q5-W4 for guile-bugs@m.gmane.org; Fri, 04 Mar 2016 04:36:08 +0100 Original-Received: from localhost ([::1]:38605 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abgX9-00026I-65 for guile-bugs@m.gmane.org; Thu, 03 Mar 2016 22:36:07 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59132) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abgX5-00025z-9n for bug-guile@gnu.org; Thu, 03 Mar 2016 22:36:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abgX4-00058R-A7 for bug-guile@gnu.org; Thu, 03 Mar 2016 22:36:03 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35365) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abgX4-00058N-6B for bug-guile@gnu.org; Thu, 03 Mar 2016 22:36:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1abgX3-00056o-Vp for bug-guile@gnu.org; Thu, 03 Mar 2016 22:36:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Zefram Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 04 Mar 2016 03:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 22902 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.145706250619414 (code B ref -1); Fri, 04 Mar 2016 03:36:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Mar 2016 03:35:06 +0000 Original-Received: from localhost ([127.0.0.1]:60724 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1abgWA-000533-CM for submit@debbugs.gnu.org; Thu, 03 Mar 2016 22:35:06 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:39824) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1abgW8-00052W-Lc for submit@debbugs.gnu.org; Thu, 03 Mar 2016 22:35:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abgW2-0004xZ-6j for submit@debbugs.gnu.org; Thu, 03 Mar 2016 22:34:58 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:47030) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abgW2-0004xV-3u for submit@debbugs.gnu.org; Thu, 03 Mar 2016 22:34:58 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59028) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abgW1-0001on-4P for bug-guile@gnu.org; Thu, 03 Mar 2016 22:34:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abgW0-0004xJ-70 for bug-guile@gnu.org; Thu, 03 Mar 2016 22:34:57 -0500 Original-Received: from river6.fysh.org ([2001:41d0:d:20da::2]:39735 helo=river.fysh.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abgW0-0004xF-0U for bug-guile@gnu.org; Thu, 03 Mar 2016 22:34:56 -0500 Original-Received: from zefram by river.fysh.org with local (Exim 4.80 #2 (Debian)) id 1abgVw-0002Et-9K; Fri, 04 Mar 2016 03:34:52 +0000 Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7976 Archived-At: The documentation claims that setting GUILE_INSTALL_LOCALE=1 in the environment is equivalent to calling (setlocale LC_ALL "") at startup. Actually there is at least one difference: calling setlocale causes ports (both primordial and later-opened) to be initially configured for the locale's nominal character encoding, but setting the environment variable does not. Setting the environment variable leaves the port encoding at #f, functioning as ISO-8859-1, just as if locale had not been invoked at all. I do see some effects from setting the environment variable, specifically message strings affecting strftime. $ echo -n $'L\xc3\xa9on' | LANG=de_DE.UTF-8 guile-2.0 -c '(write (strftime "%c" (gmtime 1000000000))) (newline) (write (port-encoding (current-input-port))) (newline) (write (map char->integer (let r ((l '\''())) (let ((c (read-char (current-input-port)))) (if (eof-object? c) (reverse l) (r (cons c l))))))) (newline)' "Sun Sep 9 01:46:40 2001" #f (76 195 169 111 110) $ echo -n $'L\xc3\xa9on' | GUILE_INSTALL_LOCALE=1 LANG=de_DE.UTF-8 guile-2.0 -c '(write (strftime "%c" (gmtime 1000000000))) (newline) (write (port-encoding (current-input-port))) (newline) (write (map char->integer (let r ((l '\''())) (let ((c (read-char (current-input-port)))) (if (eof-object? c) (reverse l) (r (cons c l))))))) (newline)' "So 09 Sep 2001 01:46:40 GMT" #f (76 195 169 111 110) $ echo -n $'L\xc3\xa9on' | LANG=de_DE.UTF-8 guile-2.0 -c '(setlocale LC_ALL "") (write (strftime "%c" (gmtime 1000000000))) (newline) (write (port-encoding (current-input-port))) (newline) (write (map char->integer (let r ((l '\''())) (let ((c (read-char (current-input-port)))) (if (eof-object? c) (reverse l) (r (cons c l))))))) (newline)' "So 09 Sep 2001 01:46:40 GMT" "UTF-8" (76 233 111 110) In case anyone trawls the archives later investigating the usage of GUILE_INSTALL_LOCALE: I am not attempting to use it myself, despite the scenario implied by the above test cases. I think it's a bloody stupid mechanism, imposing on the program something that needs to be under the program's control, and which previously was. I'm actually investigating how to make programs cope with the unpredictable situation caused by this mechanism with the unpredictable environment setting. -zefram