From f16e53860f281bc6677c2835d5b0225831a41739 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Fri, 4 May 2012 18:23:00 +0800 Subject: [PATCH] * select.el (xselect--encode-string): Always use utf-8 for TEXT on Nextstep. --- lisp/ChangeLog | 5 +++++ lisp/select.el | 42 ++++++++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ae273d9d610..dbbb2fb4c76 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-05-04 Chong Yidong + + * select.el (xselect--encode-string): Always use utf-8 for TEXT on + Nextstep. + 2012-04-30 Eli Zaretskii * mail/rmail.el (rmail-yank-current-message): Use the encoding of diff --git a/lisp/select.el b/lisp/select.el index 3948fcc5456..d3153a0ce0e 100644 --- a/lisp/select.el +++ b/lisp/select.el @@ -228,24 +228,30 @@ two markers or an overlay. Otherwise, it is nil." ;; But avoid modifying the string if it's a buffer name etc. (unless can-modify (setq str (substring str 0))) (remove-text-properties 0 (length str) '(composition nil) str) - ;; TEXT is a polymorphic target. Select the actual type - ;; from `UTF8_STRING', `COMPOUND_TEXT', `STRING', and - ;; `C_STRING'. - (if (eq type 'TEXT) - (if (not (multibyte-string-p str)) - (setq type 'C_STRING) - (let (non-latin-1 non-unicode eight-bit) - (mapc #'(lambda (x) - (if (>= x #x100) - (if (< x #x110000) - (setq non-latin-1 t) - (if (< x #x3FFF80) - (setq non-unicode t) - (setq eight-bit t))))) - str) - (setq type (if non-unicode 'COMPOUND_TEXT - (if non-latin-1 'UTF8_STRING - (if eight-bit 'C_STRING 'STRING))))))) + ;; For X selections, TEXT is a polymorphic target; choose + ;; the actual type from `UTF8_STRING', `COMPOUND_TEXT', + ;; `STRING', and `C_STRING'. On Nextstep, always use UTF-8 + ;; (see ns_string_to_pasteboard_internal in nsselect.m). + (when (eq type 'TEXT) + (cond + ((featurep 'ns) + (setq type 'UTF8_STRING)) + ((not (multibyte-string-p str)) + (setq type 'C_STRING)) + (t + (let (non-latin-1 non-unicode eight-bit) + (mapc #'(lambda (x) + (if (>= x #x100) + (if (< x #x110000) + (setq non-latin-1 t) + (if (< x #x3FFF80) + (setq non-unicode t) + (setq eight-bit t))))) + str) + (setq type (if non-unicode 'COMPOUND_TEXT + (if non-latin-1 'UTF8_STRING + (if eight-bit 'C_STRING + 'STRING)))))))) (cond ((eq type 'UTF8_STRING) (if (or (not coding) -- 2.11.4.GIT