changeset 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 70bc5da33dfa
children 790e14d9baae
files lisp/ChangeLog lisp/select.el
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Sep 16 15:29:51 2006 +0000
+++ b/lisp/ChangeLog	Sat Sep 16 17:12:38 2006 +0000
@@ -1,3 +1,8 @@
+2006-09-16  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* select.el (xselect-convert-to-string): If UTF8_STRING is requested
+	and the data doesn't look like UTF8, send STRING instead.
+
 2006-09-16  Agustin Martin <agustin.martin@hispalinux.es>
 
 	* textmodes/flyspell.el (flyspell-check-region-doublons): New
--- 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))
 	   )))