From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.bugs Subject: bug#18520: string ports should not have an encoding Date: Mon, 22 Sep 2014 14:21:21 +0200 Message-ID: <87mw9rq20u.fsf@gnu.org> References: <87iokgmttc.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 1411388550 20515 80.91.229.3 (22 Sep 2014 12:22:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 22 Sep 2014 12:22:30 +0000 (UTC) Cc: 18520@debbugs.gnu.org To: David Kastrup Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Sep 22 14:22:23 2014 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 1XW2dL-0002bW-9r for guile-bugs@m.gmane.org; Mon, 22 Sep 2014 14:22:23 +0200 Original-Received: from localhost ([::1]:45802 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XW2dK-0002zH-Qb for guile-bugs@m.gmane.org; Mon, 22 Sep 2014 08:22:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58360) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XW2dB-0002qu-IB for bug-guile@gnu.org; Mon, 22 Sep 2014 08:22:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XW2d5-0002Xv-Mh for bug-guile@gnu.org; Mon, 22 Sep 2014 08:22:13 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56614) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XW2d5-0002Wv-KV for bug-guile@gnu.org; Mon, 22 Sep 2014 08:22:07 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XW2cz-0005l8-RU for bug-guile@gnu.org; Mon, 22 Sep 2014 08:22:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 22 Sep 2014 12:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18520 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 18520-submit@debbugs.gnu.org id=B18520.141138848622089 (code B ref 18520); Mon, 22 Sep 2014 12:22:01 +0000 Original-Received: (at 18520) by debbugs.gnu.org; 22 Sep 2014 12:21:26 +0000 Original-Received: from localhost ([127.0.0.1]:48178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XW2cP-0005kC-Er for submit@debbugs.gnu.org; Mon, 22 Sep 2014 08:21:25 -0400 Original-Received: from hera.aquilenet.fr ([141.255.128.1]:55637) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XW2cL-0005k0-FB for 18520@debbugs.gnu.org; Mon, 22 Sep 2014 08:21:22 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id E92AF3A84; Mon, 22 Sep 2014 14:21:20 +0200 (CEST) Original-Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 104wVn5IyTge; Mon, 22 Sep 2014 14:21:20 +0200 (CEST) Original-Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 7F9AD3A69; Mon, 22 Sep 2014 14:21:20 +0200 (CEST) In-Reply-To: <87iokgmttc.fsf@fencepost.gnu.org> (David Kastrup's message of "Mon, 22 Sep 2014 01:34:39 +0200") User-Agent: Gnus/5.130011 (Ma Gnus v0.11) Emacs/24.3 (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:7567 Archived-At: I see my reply failed to address some of the points raised. David Kastrup skribis: > Guile-2.2 does not consult %default-port-encoding but uses UTF-8 > consistently (I guess, overriding set-port-encoding! will again change > that). > > That still is not satisfactory. For example, using ftell on the input > port will not report the string index of the string connected to the > string port but rather a byte index into a UTF-8 encoded version of the > string. This is a number that has nothing to do with the original > string and cannot be used for correlating string and port. Right. > Ports fundamentally deliver characters, and so reading and writing from > a string source/sink should not involve _any_ coding system. > > Files fundamentally deliver bytes, a conversion is required. The same > would be the case when opening a port on a _bytevector_. Here an > encoding would make equally make sense, and ftell/fseek offsets would > naturally be in bytes. But a port on a string delivers and consumes > characters. Any conversion, even a fixed UTF-8 conversion, will destroy > the predictable nature of with-output-to-string and > with-input-from-string and the respective uses of string ports. Guile ports can be mixed textual/binary (unlike R6 ports, which are either textual or binary.) Thus, they fundamentally deliver bytes, possibly with a textual conversion. Although the manual isn=E2=80=99t clear about it, =E2=80=98ftell=E2=80=99, = when available, returns a position in bytes. The situation for string ports here is comparable to that of other ports used for textual I/O. Do you have a situation where you were relying on 1.8=E2=80=99s behavior in= that regard? Could we see whether this can be solved differently? Thanks, Ludo=E2=80=99.