From unknown Thu Jun 19 14:05:39 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#22750 <22750@debbugs.gnu.org> To: bug#22750 <22750@debbugs.gnu.org> Subject: Status: Output port encoding isn't correctly set Reply-To: bug#22750 <22750@debbugs.gnu.org> Date: Thu, 19 Jun 2025 21:05:39 +0000 retitle 22750 Output port encoding isn't correctly set reassign 22750 guile submitter 22750 Roland Lutz severity 22750 normal tag 22750 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 20 13:25:01 2016 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 To: bug-guile@gnu.org Subject: Output port encoding isn't correctly set 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-Debbugs-Envelope-To: submit 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 debbugs-submit-bounces@debbugs.gnu.org Fri Feb 26 13:53:58 2016 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 To: Roland Lutz Subject: Re: bug#22750: Output port encoding isn't correctly set 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-Debbugs-Envelope-To: 22750 Cc: control@debbugs.gnu.org, 22750@debbugs.gnu.org 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 From unknown Thu Jun 19 14:05:39 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 26 Mar 2016 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator