From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.bugs Subject: bug#20200: GUILE 2.0.11: open-bytevector-input-port fails to open in binary mode Date: Thu, 26 Mar 2015 18:57:53 -0400 Message-ID: <87iodn8iz2.fsf@netris.org> References: <871tkd9mij.fsf@fencepost.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1427410705 18828 80.91.229.3 (26 Mar 2015 22:58:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 26 Mar 2015 22:58:25 +0000 (UTC) Cc: 20200@debbugs.gnu.org To: David Kastrup Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Thu Mar 26 23:58:13 2015 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YbGj5-0004j6-3N for guile-bugs@m.gmane.org; Thu, 26 Mar 2015 23:58:11 +0100 Original-Received: from localhost ([::1]:46893 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbGj4-0007xW-Gl for guile-bugs@m.gmane.org; Thu, 26 Mar 2015 18:58:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbGj1-0007qH-7F for bug-guile@gnu.org; Thu, 26 Mar 2015 18:58:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbGiw-0003j8-DH for bug-guile@gnu.org; Thu, 26 Mar 2015 18:58:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47890) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbGiw-0003j4-9m for bug-guile@gnu.org; Thu, 26 Mar 2015 18:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YbGiv-0008PO-Tc for bug-guile@gnu.org; Thu, 26 Mar 2015 18:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mark H Weaver Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 26 Mar 2015 22:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20200 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 20200-submit@debbugs.gnu.org id=B20200.142741065232282 (code B ref 20200); Thu, 26 Mar 2015 22:58:01 +0000 Original-Received: (at 20200) by debbugs.gnu.org; 26 Mar 2015 22:57:32 +0000 Original-Received: from localhost ([127.0.0.1]:37666 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YbGiS-0008Oc-20 for submit@debbugs.gnu.org; Thu, 26 Mar 2015 18:57:32 -0400 Original-Received: from world.peace.net ([50.252.239.5]:38829 ident=hope6) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YbGiQ-0008OS-IM for 20200@debbugs.gnu.org; Thu, 26 Mar 2015 18:57:31 -0400 Original-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 1YbGiJ-00037a-EU; Thu, 26 Mar 2015 18:57:23 -0400 In-Reply-To: <871tkd9mij.fsf@fencepost.gnu.org> (David Kastrup's message of "Wed, 25 Mar 2015 15:31:32 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7757 Archived-At: David Kastrup writes: > Run the following code in an UTF-8 capable locale: > > (setlocale LC_ALL "") > (use-modules (rnrs io ports) (rnrs bytevectors) (ice-9 format)) > (let ((p (open-bytevector-input-port > (u8-list->bytevector '(#xc3 #x9f #xc3 #X9f))))) > (format #t "~a ~a\n" (port-encoding p) (binary-port? p)) > (format #t "#x~x\n" (char->integer (read-char p))) > (format #t "~a ~a\n" (port-encoding p) (binary-port? p)) > (set-port-encoding! p "ISO-8859-1") > (format #t "~a ~a\n" (port-encoding p) (binary-port? p)) > (format #t "#x~x\n" (char->integer (read-char p))) > (format #t "~a ~a\n" (port-encoding p) (binary-port? p))) > > This results in the output > #f #t > #xdf > #f #t > ISO-8859-1 #f > #xc3 > ISO-8859-1 #f > > The manual, however, states: > > -- Scheme Procedure: port-encoding port > -- C Function: scm_port_encoding (port) > Returns, as a string, the character encoding that PORT uses to > interpret its input and output. The value =E2=80=98#f=E2=80=99 is e= quivalent to > =E2=80=98"ISO-8859-1"=E2=80=99. > > That would appear to be false since the value #f here is treated as > equivalent to "UTF-8" rather than "ISO-8859-1". This is indeed a bug, introduced in Guile 2.0.9. The workaround is to explicitly set the encoding to "ISO-8859-1". Mark