From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Romain Francoise Newsgroups: gmane.emacs.devel Subject: Re: Cut buffers and character encoding Date: Thu, 09 Nov 2006 21:56:29 +0100 Organization: orebokech dot com Message-ID: <87mz70730i.fsf@pacem.orebokech.com> References: <87y7qldq6h.fsf@pacem.orebokech.com> <45537D3A.5080400@swipnet.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1163105844 16274 80.91.229.2 (9 Nov 2006 20:57:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 9 Nov 2006 20:57:24 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 09 21:57:21 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GiGwz-0004wG-9K for ged-emacs-devel@m.gmane.org; Thu, 09 Nov 2006 21:56:44 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GiGwx-0005CE-PA for ged-emacs-devel@m.gmane.org; Thu, 09 Nov 2006 15:56:39 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GiGwl-0005Af-Ms for emacs-devel@gnu.org; Thu, 09 Nov 2006 15:56:27 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GiGwh-00054f-Io for emacs-devel@gnu.org; Thu, 09 Nov 2006 15:56:26 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GiGwh-00054Y-Bk for emacs-devel@gnu.org; Thu, 09 Nov 2006 15:56:23 -0500 Original-Received: from [82.67.41.165] (helo=yeast.orebokech.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GiGwh-0002qb-9h for emacs-devel@gnu.org; Thu, 09 Nov 2006 15:56:23 -0500 Original-Received: from pacem.orebokech.com (pacem.orebokech.com [192.168.1.3]) by yeast.orebokech.com (Postfix) with ESMTP id E82A512CF8; Thu, 9 Nov 2006 21:56:20 +0100 (CET) Original-Received: by pacem.orebokech.com (Postfix, from userid 1000) id 4B83552458; Thu, 9 Nov 2006 21:56:29 +0100 (CET) Original-To: "Jan D." X-Face: }9mYu,e_@+e!`Z-P5kVXa3\_b:hdJ"B)ww[&=b<2=awG:GOIM (Jan D.'s message of "Thu\, 09 Nov 2006 20\:10\:50 +0100") 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:62007 Archived-At: "Jan D." writes: > The text encoding for cut buffers are defined to be ISO-Latin-1, so > selection-coding-system should not have any effect. That said, we > could decode data from cut buffers from Latin-1 and encode to Latin-1 > when putting data in there. Ah, thanks, you put me on the right track. Emacs *does* decode the contents of the cut buffer in the `x-cut-buffer-or-selection-value' function, but it tries to decode them using `locale-coding-system' which is wrong if the locale is a UTF-8 locale... The following patch fixes the problem for me, and if cut buffers are *always* iso-latin-1 then it should be the right thing. WDYT? Index: lisp/term/x-win.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/term/x-win.el,v retrieving revision 1.194 diff -c -r1.194 x-win.el *** lisp/term/x-win.el 18 Oct 2006 14:05:02 -0000 1.194 --- lisp/term/x-win.el 9 Nov 2006 20:54:47 -0000 *************** *** 2346,2353 **** (t (setq x-last-selected-text-cut-encoded cut-text x-last-selected-text-cut ! (decode-coding-string cut-text (or locale-coding-system ! 'iso-latin-1)))))) ;; As we have done one selection, clear this now. (setq next-selection-coding-system nil) --- 2346,2352 ---- (t (setq x-last-selected-text-cut-encoded cut-text x-last-selected-text-cut ! (decode-coding-string cut-text 'iso-latin-1))))) ;; As we have done one selection, clear this now. (setq next-selection-coding-system nil) -- Romain Francoise | The sea! the sea! the open it's a miracle -- http://orebokech.com/ | sea! The blue, the fresh, the | ever free! --Bryan W. Procter