emacs-pretest-bug
[Top][All Lists]
Advanced

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

x-clipboard-yank doesn't decode utf-8 string


From: Zhang Wei
Subject: x-clipboard-yank doesn't decode utf-8 string
Date: Thu, 9 Jun 2005 00:57:06 +0800

The following line has been put in my .emacs:

  (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)

When I select some text from Mozilla-firefox using left mouse
button, but without issuing cut/copy command explicitly, then I paste
in emacs with middle mouse button or C-y, everything is OK,
which means the X PRIMARY selection method works fine.

But if I issue cut/copy command explicitly after
selection (select Edit/copy from Mozilla-firefox's menu, or C-c),
and then paste in emacs using Edit/paste menu item, what I got is
undecoded utf string, something like this "\u60a8\u4e0a\u6b21",
it seems that the X CLIPBOARD selection method does not work.

The following patch could fix this problem, but I'm not sure if
it is the best way.

------------------------------------------------------------------------------
*** x-win.el    2005-05-30 02:44:48.000000000 +0800
--- x-win.el.new        2005-06-08 23:38:30.330605432 +0800
***************
*** 2446,2452 ****
    (interactive)
    (let ((clipboard-text
         (condition-case nil
!            (x-get-selection 'CLIPBOARD)
           (error nil)))
        (x-select-enable-clipboard t))
      (if (and clipboard-text (> (length clipboard-text) 0))
--- 2446,2452 ----
    (interactive)
    (let ((clipboard-text
         (condition-case nil
!            (x-selection-value 'CLIPBOARD)
           (error nil)))
        (x-select-enable-clipboard t))
      (if (and clipboard-text (> (length clipboard-text) 0))
------------------------------------------------------------------------

In GNU Emacs 23.0.0.1 (i686-pc-linux-gnu, GTK+ Version 2.6.4)
 of 2005-05-30 on dorm
Distributor `The XFree86 Project, Inc', version 11.0.40300001
configured using `configure 'CFLAGS=-g' 'prefix=/usr' '--with-x-toolkit=gtk''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: zh_CN.GBK
  locale-coding-system: chinese-gbk
  default-enable-multibyte-characters: t




reply via email to

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