Commit ab263a79 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

(gui-get-selection): Avoid using `string-to-multibyte'

* lisp/select.el (gui-get-selection): Avoid using
`string-to-multibyte' -- instead encode as `eight-bit' if the
string is unibyte.
parent 54f5d678
Pipeline #1696 failed with stage
in 90 minutes and 4 seconds
......@@ -308,8 +308,15 @@ the formats available in the clipboard if TYPE is `CLIPBOARD'."
('STRING 'iso-8859-1)
(_ (error "Unknown selection data type: %S"
(setq data (if coding (decode-coding-string data coding)
(string-to-multibyte data))))
(setq data (cond
(decode-coding-string data coding))
;; The last two cases are only possible in the
;; C_STRING case.
((multibyte-string-p data)
(encode-coding-string data 'eight-bit)))))
(setq next-selection-coding-system nil)
(put-text-property 0 (length data) 'foreign-selection data-type data))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment