emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cut buffers and character encoding


From: Romain Francoise
Subject: Re: Cut buffers and character encoding
Date: Thu, 09 Nov 2006 21:56:29 +0100

"Jan D." <address@hidden> 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 <address@hidden> | The sea! the sea! the open
it's a miracle -- http://orebokech.com/ | sea! The blue, the fresh, the
                                        | ever free! --Bryan W. Procter




reply via email to

[Prev in Thread] Current Thread [Next in Thread]