From unknown Sun Jun 22 07:50:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22750: Output port encoding isn't correctly set Resent-From: Roland Lutz Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 20 Feb 2016 18:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 22750 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 22750@debbugs.gnu.org X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.145599270117413 (code B ref -1); Sat, 20 Feb 2016 18:25:02 +0000 Received: (at submit) by debbugs.gnu.org; 20 Feb 2016 18:25:01 +0000 Received: from localhost ([127.0.0.1]:35569 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aXCDF-0004Wn-9l for submit@debbugs.gnu.org; Sat, 20 Feb 2016 13:25:01 -0500 Received: from eggs.gnu.org ([208.118.235.92]:39960) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aX9w5-000163-6J for submit@debbugs.gnu.org; Sat, 20 Feb 2016 10:59:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aX9vz-0008Aq-34 for submit@debbugs.gnu.org; Sat, 20 Feb 2016 10:59:03 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:41376) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aX9vz-0008Am-05 for submit@debbugs.gnu.org; Sat, 20 Feb 2016 10:59:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59163) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aX9vy-00069v-2t for bug-guile@gnu.org; Sat, 20 Feb 2016 10:59:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aX9vu-00089Y-TO for bug-guile@gnu.org; Sat, 20 Feb 2016 10:59:02 -0500 Received: from abakus.grinsen-ohne-katze.de ([178.77.97.95]:56256) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aX9vu-000899-Mw for bug-guile@gnu.org; Sat, 20 Feb 2016 10:58:58 -0500 Received: from localhost ([::1]) by abakus.grinsen-ohne-katze.de with esmtp (Exim 4.80) (envelope-from ) id 1aX9vq-0005cU-FN for bug-guile@gnu.org; Sat, 20 Feb 2016 16:58:54 +0100 Date: Sat, 20 Feb 2016 16:56:47 +0100 (CET) From: Roland Lutz Message-ID: User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323329-1520801208-1455983807=:11620" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Mailman-Approved-At: Sat, 20 Feb 2016 13:25:00 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1520801208-1455983807=:11620 Content-Type: TEXT/PLAIN; format=flowed; charset=UTF-8 Content-Transfer-Encoding: 8BIT 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 --8323329-1520801208-1455983807=:11620-- From unknown Sun Jun 22 07:50:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22750: Output port encoding isn't correctly set Resent-From: Mark H Weaver Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 26 Feb 2016 18:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22750 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Roland Lutz Cc: control@debbugs.gnu.org, 22750@debbugs.gnu.org Received: via spool by 22750-submit@debbugs.gnu.org id=B22750.145651283811841 (code B ref 22750); Fri, 26 Feb 2016 18:54:02 +0000 Received: (at 22750) by debbugs.gnu.org; 26 Feb 2016 18:53:58 +0000 Received: from localhost ([127.0.0.1]:47891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aZNWY-00034q-AX for submit@debbugs.gnu.org; Fri, 26 Feb 2016 13:53:58 -0500 Received: from world.peace.net ([50.252.239.5]:45733 ident=hope3) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aZNWW-00034d-GF; Fri, 26 Feb 2016 13:53:56 -0500 Received: from [10.1.10.78] (helo=jojen) by world.peace.net with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aZNWP-0006yD-46; Fri, 26 Feb 2016 13:53:49 -0500 From: Mark H Weaver References: Date: Fri, 26 Feb 2016 13:53:46 -0500 In-Reply-To: (Roland Lutz's message of "Sat, 20 Feb 2016 16:56:47 +0100 (CET)") Message-ID: <87twkvb8w5.fsf@netris.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) tags 22750 + notabug close 22750 thanks Roland Lutz 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