From b984fed926ff00c7468acc0f6f4b0fc1ad6c72be Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Sat, 16 Sep 2006 17:12:38 +0000 Subject: [PATCH] * select.el (xselect-convert-to-string): If UTF8_STRING is requested and the data doesn't look like UTF8, send STRING instead. --- lisp/ChangeLog | 5 +++++ lisp/select.el | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e349a82bab3..bd291081b9d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-09-16 Jan Dj,Ad(Brv + + * 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 * textmodes/flyspell.el (flyspell-check-region-doublons): New diff --git a/lisp/select.el b/lisp/select.el index 01d1af6edf1..cbdeaf12fe3 100644 --- a/lisp/select.el +++ b/lisp/select.el @@ -223,8 +223,11 @@ Cut buffers are considered obsolete; you should use selections instead." (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)) ))) -- 2.39.2