diff lisp/select.el @ 72927:7c06d1194d6f

* select.el (xselect-convert-to-string): If UTF8_STRING is requested and the data doesn't look like UTF8, send STRING instead.
author Jan Djärv <jan.h.d@swipnet.se>
date Sat, 16 Sep 2006 17:12:38 +0000
parents 3bd95f4f2941
children 50ad827e063d b5c13d1564a9
line wrap: on
line diff
--- a/lisp/select.el	Sat Sep 16 15:29:51 2006 +0000
+++ b/lisp/select.el	Sat Sep 16 17:12:38 2006 +0000
@@ -223,8 +223,11 @@
 	      (setq str (encode-coding-string str coding))))
 
 	   ((eq type 'UTF8_STRING)
-	    (setq str (encode-coding-string str 'utf-8)))
-
+	    (let ((charsets (find-charset-string str)))
+	      (if (or (memq 'eight-bit-control charsets)
+		      (memq 'eight-bit-graphic charsets))
+		  (setq type 'STRING)
+		(setq str (encode-coding-string str 'utf-8)))))
 	   (t
 	    (error "Unknow selection type: %S" type))
 	   )))