Subject: bug#45: 3.0.60; Can't paste from files with .arc extensions

From: Chong Yidong <[email-masked]>
Date: Mon, 07 Apr 2008 23:26:37 -0400

Magnus Henoch <[email-masked]> wrote:

> 1. Create a new buffer.
> 2. Make it single-byte with M-x toggle-enable-multibyte-characters
> 3. Write something and copy it with M-x clipboard-kill-ring-save
> 4. Try to paste it into Firefox with C-v
>
> For me, nothing happens in step 4.

This bug arises from the following checkin, introduced to the unicode-2
branch on Nov 18 and subsequently merged to the trunk:

2008-02-01  Kenichi Handa  <[email-masked]>

	* select.el (selection-coding-system, next-selection-coding-system):
	Move declarations from xselect.c.
	(x-get-selection): Decode by selection-coding-system if it is non-nil.
	If it is nil, decode by a proper coding system.  Handle C_STRING.
	(ccl-check-utf-8, string-utf-8-p): Delete them.
	(xselect-convert-to-string): Fix determining data-type in the case
	that TEXT is requested.  Don't use selection-coding-system if it's
	not proper for the data-type.

The problem seems to go away with the following patch to
xselect-convert-to-string, which changes the coding for unibyte string
from C_STRING back to STRING, the value prior to the Nov 18 change.  But
I am unfamiliar with this part of the code.  Could someone who knows
what is going on give an opinion (Handa-san)?

*** trunk/lisp/select.el.~1.39.~	2008-02-08 15:16:35.000000000 -0500
--- trunk/lisp/select.el	2008-04-07 23:15:34.000000000 -0400
***************
*** 243,249 ****
  	  (remove-text-properties 0 (length str) '(composition nil) str)
  	  (if (not (multibyte-string-p str))
  	      ;; Don't have to encode unibyte string.
! 	      (setq type 'C_STRING)
  	    (if (eq type 'TEXT)
  		;; TEXT is a polimorphic target.  We must select the
  		;; actual type from `UTF8_STRING', `COMPOUND_TEXT',
--- 243,249 ----
  	  (remove-text-properties 0 (length str) '(composition nil) str)
  	  (if (not (multibyte-string-p str))
  	      ;; Don't have to encode unibyte string.
! 	      (setq type 'STRING)
  	    (if (eq type 'TEXT)
  		;; TEXT is a polimorphic target.  We must select the
  		;; actual type from `UTF8_STRING', `COMPOUND_TEXT',