unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Zefram <zefram@fysh.org>
To: 22910@debbugs.gnu.org
Subject: bug#22910: read-only setlocale has side effect
Date: Fri, 4 Mar 2016 16:48:59 +0000	[thread overview]
Message-ID: <20160304164859.GE7946@fysh.org> (raw)

A call to setlocale with no second argument is documented to be
a read-only operation, querying the current locale configuration.
In fact it has a side effect of setting the encoding on primordial ports:

$ guile-2.0 -c '(write (port-encoding (current-input-port))) (newline) (setlocale LC_TIME) (write (port-encoding (current-input-port))) (newline)'
#f
"ANSI_X3.4-1968"

Observe that this occurs even if the locale reading operation is for a
category unrelated to character encoding.  The actual decoding behaviour
of read-char is altered in accordance with the reported encoding.
Non-primordial ports opened before or after the setlocale call are
not affected.

-zefram





             reply	other threads:[~2016-03-04 16:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-04 16:48 Zefram [this message]
2016-03-04 19:55 ` bug#22910: read-only setlocale has side effect Zefram
2016-08-07 21:58 ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160304164859.GE7946@fysh.org \
    --to=zefram@fysh.org \
    --cc=22910@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).