From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.bugs Subject: bug#22901: drain-input doesn't decode Date: Mon, 20 Jun 2016 18:12:50 +0200 Message-ID: <87d1nbg7p9.fsf@pobox.com> References: <20160304030944.GA1318@fysh.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1466440461 18517 80.91.229.3 (20 Jun 2016 16:34:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 20 Jun 2016 16:34:21 +0000 (UTC) Cc: 22901@debbugs.gnu.org To: Zefram Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Jun 20 18:34:10 2016 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 1bF29K-0005IY-62 for guile-bugs@m.gmane.org; Mon, 20 Jun 2016 18:34:10 +0200 Original-Received: from localhost ([::1]:44866 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF29J-0001eg-I0 for guile-bugs@m.gmane.org; Mon, 20 Jun 2016 12:34:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF1pw-0004uK-8L for bug-guile@gnu.org; Mon, 20 Jun 2016 12:14:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bF1pq-0001Mp-3I for bug-guile@gnu.org; Mon, 20 Jun 2016 12:14:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35593) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF1pp-0001Mk-W4 for bug-guile@gnu.org; Mon, 20 Jun 2016 12:14:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bF1pp-0003MW-Pl for bug-guile@gnu.org; Mon, 20 Jun 2016 12:14:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andy Wingo Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 20 Jun 2016 16:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22901 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 22901-submit@debbugs.gnu.org id=B22901.146643918212848 (code B ref 22901); Mon, 20 Jun 2016 16:14:01 +0000 Original-Received: (at 22901) by debbugs.gnu.org; 20 Jun 2016 16:13:02 +0000 Original-Received: from localhost ([127.0.0.1]:47930 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bF1or-0003L0-JM for submit@debbugs.gnu.org; Mon, 20 Jun 2016 12:13:01 -0400 Original-Received: from pb-sasl1.pobox.com ([64.147.108.66]:62952 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bF1op-0003Kj-UT for 22901@debbugs.gnu.org; Mon, 20 Jun 2016 12:13:00 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id B6871234B8; Mon, 20 Jun 2016 12:12:59 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=y4R4cYS9EkYmfXQv09LXm8Itk7w=; b=ERnacB mLvkD4zAv3Pl7n95yTv27yNPKPnb8gbURxkX3wiqkX8TI2K3A/bcz3h5IJIR77y6 6V9eRqIUXYflsePzJRfvLhkhqlVRDQKawJW1WEgZajbyaxguwkiwkoFOB0U3oTDj G0y8EksJ0VValrx9UjRVQ8xcKNdW+Xw9Tgj28= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=IsjO+jwE6DP1FymnJbvgWW7fqMqXQHKX 0shWKnjA5RUrZUXhyMJSmGIkavh5Bo98JZAVoNuzKNOSXfsf18S7nvhSkBACeJ48 GTd+nr7/sB6fPN6AkqB5OcGIGglXoVCTMMhLzmAzyoZxdbxmcONJa6e5SsuRxvFp 478xAdOan+0= Original-Received: from pb-sasl1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id AFC49234B7; Mon, 20 Jun 2016 12:12:59 -0400 (EDT) Original-Received: from clucks (unknown [88.160.190.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl1.pobox.com (Postfix) with ESMTPSA id BCEFB234B1; Mon, 20 Jun 2016 12:12:58 -0400 (EDT) In-Reply-To: <20160304030944.GA1318@fysh.org> (zefram@fysh.org's message of "Fri, 4 Mar 2016 03:09:44 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-Pobox-Relay-ID: DB0ED0CA-3701-11E6-A060-C1836462E9F6-02397024!pb-sasl1.pobox.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.lisp.guile.bugs:8029 Archived-At: On Fri 04 Mar 2016 04:09, Zefram writes: > The documentation for drain-input says that it returns a string of > characters, implying that the result is equivalent to what you'd get > from calling read-char some number of times. In fact it differs in a > significant respect: whereas read-char decodes input octets according to > the port's selected encoding, drain-input ignores the selected encoding > and always decodes according to ISO-8859-1 (thus preserving the octet > values in character form). > > $ echo -n $'\1a\2b\3c' | guile-2.0 -c '(set-port-encoding! > (current-input-port) "UCS-2BE") (write (port-encoding > (current-input-port))) (newline) (write (map char->integer (let r ((l > '\''())) (let ((c (read-char (current-input-port)))) (if (eof-object? > c) (reverse l) (r (cons c l))))))) (newline)' > "UCS-2BE" > (353 610 867) > $ echo -n $'\1a\2b\3c' | guile-2.0 -c '(set-port-encoding! > (current-input-port) "UCS-2BE") (write (port-encoding > (current-input-port))) (newline) (peek-char (current-input-port)) > (write (map char->integer (string->list (drain-input > (current-input-port))))) (newline)' > "UCS-2BE" > (1 97 2 98 3 99) Thanks for the test case! FWIW, this is fixed in Guile 2.1.3. I am not sure what we should do about Guile 2.0. I guess we should make it do the documented thing though! Andy