From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stephen J. Turnbull" Newsgroups: gmane.emacs.devel Subject: Re: utf-16le vs utf-16-le Date: Wed, 16 Apr 2008 01:51:50 +0900 Message-ID: <87wsmzdpsp.fsf@uwakimon.sk.tsukuba.ac.jp> References: <87wsn1fl72.fsf@uwakimon.sk.tsukuba.ac.jp> <87prssgacl.fsf@uwakimon.sk.tsukuba.ac.jp> <851w58q24a.fsf@lola.goethe.zz> <87lk3gfg40.fsf@uwakimon.sk.tsukuba.ac.jp> <87fxtof8x1.fsf@uwakimon.sk.tsukuba.ac.jp> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1208279261 31742 80.91.229.12 (15 Apr 2008 17:07:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 15 Apr 2008 17:07:41 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 15 19:08:14 2008 connect(): Connection refused Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JloG4-0006pa-5P for ged-emacs-devel@m.gmane.org; Tue, 15 Apr 2008 18:43:48 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JloFP-0000xQ-IK for ged-emacs-devel@m.gmane.org; Tue, 15 Apr 2008 12:43:07 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JloEN-00080g-4B for emacs-devel@gnu.org; Tue, 15 Apr 2008 12:42:03 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JloEL-0007yT-ML for emacs-devel@gnu.org; Tue, 15 Apr 2008 12:42:02 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JloEL-0007yC-Eq for emacs-devel@gnu.org; Tue, 15 Apr 2008 12:42:01 -0400 Original-Received: from mtps01.sk.tsukuba.ac.jp ([130.158.97.223]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JloED-0004fH-B9; Tue, 15 Apr 2008 12:41:53 -0400 Original-Received: from uwakimon.sk.tsukuba.ac.jp (uwakimon.sk.tsukuba.ac.jp [130.158.99.156]) by mtps01.sk.tsukuba.ac.jp (Postfix) with ESMTP id 0C6171535AF; Wed, 16 Apr 2008 01:41:51 +0900 (JST) Original-Received: by uwakimon.sk.tsukuba.ac.jp (Postfix, from userid 1000) id 8B1C11A29F3; Wed, 16 Apr 2008 01:51:50 +0900 (JST) In-Reply-To: X-Mailer: VM 7.19 under 21.5 (beta28) "fuki" 2785829fe37c XEmacs Lucid X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:95290 Archived-At: Eli Zaretskii writes: > > BOM-{prohibited,auto,required}. > > But we don't have these in Emacs, do we? Huh? We don't have the full suite, but we do have -signature variants. > > > Don't forget that en/decoding is used on strings as well, not only on > > > buffers. Buffer-local variables won't cut it, I think. > > > > Strings don't have encoding signatures or newline variants > > ??? Of course, they do. Indeed? Suppose I have a string as the value of the symbol `s' containing the octets "\r\n". Please explain to me how to compute whether that is the value 0x0D0A from a network stream prepared using htons(3), or a line ending suitable for appending to a Windows file. As I wrote before: > > those octet sequences if present in a string are merely binary octet > > sequences. They only have special semantics in external > > representations. Where's the problem? > > A string can be sent to a process, for example, so we must have some > way of generating an external representation for it. Well, of course we must. But the right generalization of "buffer file coding system" is not to apply en/decoding to strings, but rather to give processes and sockets, etc, coding system properties equivalent to my proposed buffer-local variables. All I'm trying to say here is that "prepend a signature" and "translate ?\n to appropriate EOL representation" and their inverses make sense independently of the text encoding[1], and that the user interface and API could be greatly clarified if it reflected that fact. I suspect bugs like the one you encountered would be a lot less frequent if the internal architecture reflected it too, but that might be inefficient. Footnotes: [1] Obviously "prepend a signature" needs to be parametrized by the encoding in general, but in the case of Unicode UTFs it's actually independent of the UTF.