bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#22750: Output port encoding isn't correctly set


From: Roland Lutz
Subject: bug#22750: Output port encoding isn't correctly set
Date: Sat, 20 Feb 2016 16:56:47 +0100 (CET)
User-agent: Alpine 2.11 (DEB 23 2013-08-11)

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]