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#10627: char-ready? is broken for multibyte encodings Date: Sun, 24 Feb 2013 23:15:33 +0100 Message-ID: <87y5ed8ika.fsf@pobox.com> References: <87ipjwktzv.fsf@netris.org> <87d2vpedc9.fsf@pobox.com> <87ip5h79ma.fsf@tines.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1361744195 30643 80.91.229.3 (24 Feb 2013 22:16:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 24 Feb 2013 22:16:35 +0000 (UTC) Cc: 10627@debbugs.gnu.org To: Mark H Weaver Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Feb 24 23:16:58 2013 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 1U9jsJ-0004Ac-Ud for guile-bugs@m.gmane.org; Sun, 24 Feb 2013 23:16:52 +0100 Original-Received: from localhost ([::1]:60700 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9jrz-0005mn-8m for guile-bugs@m.gmane.org; Sun, 24 Feb 2013 17:16:31 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:32844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9jrv-0005mI-SE for bug-guile@gnu.org; Sun, 24 Feb 2013 17:16:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9jru-0001Xd-OY for bug-guile@gnu.org; Sun, 24 Feb 2013 17:16:27 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42721) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9jru-0001XT-Kz for bug-guile@gnu.org; Sun, 24 Feb 2013 17:16:26 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1U9jtR-00004y-Sa for bug-guile@gnu.org; Sun, 24 Feb 2013 17:18:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Andy Wingo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 24 Feb 2013 22:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10627 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 10627-submit@debbugs.gnu.org id=B10627.136174423532712 (code B ref 10627); Sun, 24 Feb 2013 22:18:01 +0000 Original-Received: (at 10627) by debbugs.gnu.org; 24 Feb 2013 22:17:15 +0000 Original-Received: from localhost ([127.0.0.1]:48185 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U9jsh-0008VZ-9d for submit@debbugs.gnu.org; Sun, 24 Feb 2013 17:17:15 -0500 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:36182 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U9jse-0008VR-EK for 10627@debbugs.gnu.org; Sun, 24 Feb 2013 17:17:13 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 2A6DABE1F; Sun, 24 Feb 2013 17:15:36 -0500 (EST) 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=/mCvmxbnUwqv5gGLPGSkda9uHtI=; b=QNkkMd tktz8fvswtDODRqhZMiLzh3CQbzIGTVFiFA86uWJQwTuubXpMpPsPvZaJokcnjyk mkVxM/4e9X1C1Zg00NoaPKeuBCHYXEZnOEljbYCW0JBvaE3LA0VUoogo1jRRAbGF tvplo0e3mk87EOtcYC6pdaIf29nN+yM5Ygcok= 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=IfZeyhF8an+s0zlMxtAsGYcZ2Zviik7X PqFbLugHRxnNjFZGwUNIgfaTajar5SvNxYsyKdtTDhfz+CDjsCgnagkFbM/2o86a OC6OkNQcS8qN//azUuliQpIDpHiCewzkLkPKI1fJH/8dR5zmMwMQCn6KN+g4rNFD JXWRT4S/FEw= Original-Received: from a-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 2331EBE1D; Sun, 24 Feb 2013 17:15:36 -0500 (EST) Original-Received: from badger (unknown [88.160.190.192]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 99BA7BE1C; Sun, 24 Feb 2013 17:15:35 -0500 (EST) In-Reply-To: <87ip5h79ma.fsf@tines.lan> (Mark H. Weaver's message of "Sun, 24 Feb 2013 15:14:05 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) X-Pobox-Relay-ID: B65F48B0-7ECF-11E2-BDC6-1C2F0E5B5709-02397024!a-pb-sasl-quonix.pobox.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.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:6782 Archived-At: Hi :) On Sun 24 Feb 2013 21:14, Mark H Weaver writes: > Andy Wingo writes: > >> On Sat 28 Jan 2012 11:21, Mark H Weaver writes: >> >>> The R5RS specifies that if 'char-ready?' returns #t, then the next >>> 'read-char' operation is guaranteed not to hang. This is not currently >>> the case for ports using a multibyte encoding. >>> >>> 'char-ready?' currently returns #t whenever at least one _byte_ is >>> available. This is not correct in general. It should return #t only if >>> there is a complete _character_ available. >> >> This procedure is omitted in the R6RS because it is not a good >> interface. Besides its semantic difficulties, can you think of a sane >> implementation for multibyte characters? > > Maybe I'm missing something, but I don't see any semantic problem here, > and it seems straightforward to implement. 'char-ready?' should simply > read bytes until either a complete character is available, or no more > bytes are ready. In either case, all the bytes should then be 'unget' > before returning. What's the problem? The problem is that char-ready? should not read anything. If you want to peek, use peek-char. Note that if the stream is at EOF, char-ready? should return #t. Andy -- http://wingolog.org/