GNU bug report logs -
#22750
Output port encoding isn't correctly set
Previous Next
Reported by: Roland Lutz <rlutz <at> hedmen.org>
Date: Sat, 20 Feb 2016 18:25:02 UTC
Severity: normal
Tags: notabug
Done: Mark H Weaver <mhw <at> netris.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22750 in the body.
You can then email your comments to 22750 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guile <at> gnu.org
:
bug#22750
; Package
guile
.
(Sat, 20 Feb 2016 18:25:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Roland Lutz <rlutz <at> hedmen.org>
:
New bug report received and forwarded. Copy sent to
bug-guile <at> gnu.org
.
(Sat, 20 Feb 2016 18:25:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
I've encountered a behavior in Guile 2.0.11 which I believe is a bug.
When running Guile in a UTF-8 locale, I'd expect that the output port
encoding is set to UTF-8 unless specified otherwise. However, it appears
to be not set at all.
This is my locale:
---
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
---
When I try to output non-ASCII characters without manually setting the
output port encoding to "UTF-8", they aren't printed correctly:
---
$ cat > tmp.scm
(display "…\n")
$ guile -s tmp.scm
;;; [compilation notes]
?
---
When I set the output port encoding to "UTF-8", it works as expected:
---
$ cat > tmp.scm
(set-port-encoding! (current-output-port) "utf-8")
(display "…\n")
$ guile -s tmp.scm
;;; [compilation notes]
…
---
Adding "; coding: utf-8" to the top of the source file doesn't change
anything.
When querying the output port encoding, it returns "#f":
---
$ cat > tmp.scm
(display (port-encoding (current-output-port)))
(newline)
$ guile -s tmp.scm
;;; [compilation notes]
#f
---
In an interactive session, the output port encoding is set correctly:
---
$ guile
GNU Guile 2.0.11
Copyright (C) 1995-2014 Free Software Foundation, Inc.
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.
Enter `,help' for help.
scheme@(guile-user)> (port-encoding (current-output-port))
$1 = "UTF-8"
---
Roland
Information forwarded
to
bug-guile <at> gnu.org
:
bug#22750
; Package
guile
.
(Fri, 26 Feb 2016 18:54:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 22750 <at> debbugs.gnu.org (full text, mbox):
tags 22750 + notabug
close 22750
thanks
Roland Lutz <rlutz <at> hedmen.org> writes:
> I've encountered a behavior in Guile 2.0.11 which I believe is a
> bug. When running Guile in a UTF-8 locale, I'd expect that the output
> port encoding is set to UTF-8 unless specified otherwise. However, it
> appears to be not set at all.
In Guile 2.0.x, as in C, the locale is not set until you set it using
'setlocale'. To set the locale according to the standard environment
variables, put this at the beginning of your script:
(setlocale LC_ALL "")
Note that in Guile 2.2.x, the locale will automatically be set when
running a script using the standard 'guile' executable, although
programs linked with libguile will still need to set the locale
explicitly.
Regards,
Mark
Added tag(s) notabug.
Request was from
Mark H Weaver <mhw <at> netris.org>
to
control <at> debbugs.gnu.org
.
(Fri, 26 Feb 2016 18:54:03 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
22750 <at> debbugs.gnu.org and Roland Lutz <rlutz <at> hedmen.org>
Request was from
Mark H Weaver <mhw <at> netris.org>
to
control <at> debbugs.gnu.org
.
(Fri, 26 Feb 2016 18:54:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 26 Mar 2016 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 years and 85 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.