rolandwalker / simpleclip

Simplified access to the system clipboard in Emacs.
173 stars 16 forks source link

Pasting utf-8 fails #9

Closed thorstengrothe closed 6 years ago

thorstengrothe commented 7 years ago

I love this package but it fails to paste utf-8 symbols from firefox for example. This are my settings:

(x-select-enable-clipboard t)
(select-enable-clipboard t)
(set-language-environment "utf-8") 
(set-default-coding-systems 'utf-8) 
(set-selection-coding-system 'utf-8) 

I always get strange symbols if I paste from clipboard manager in linux it works. How can I fix this?

Regards Thorsten

martinezhermes commented 6 years ago

This is still an issue. Emojis for example don't copy over.

rolandwalker commented 6 years ago

Hi! On what platform?

Can you copy the Emoji to a plain text file by another method, and then open that file in Emacs?

thorstengrothe commented 6 years ago

I'm on Linux here. I copied the first one from from this website in the attached file. I works fine and emacs shows me the correct symbol. When I try the same with simpleclip I got \u263a.

emoji_emacs.txt

rolandwalker commented 6 years ago

Thanks!

I was able to duplicate this on Ubuntu and enter a fix in d179b45 .

The fix is not very sophisticated. Instead of always assuming UTF8_STRING, it ought to try multiple types as in gui--selection-value-internal https://github.com/emacs-mirror/emacs/blob/2304bc9b9748db481ee1e5cff6f51709eb625394/lisp/select.el#L167-L181 .

thorstengrothe commented 6 years ago

Thanks for the fix.

henrymazza commented 4 years ago

I'm getting this on version 1.0.10. Am I doing something wrong? It pastes any non ASCII char like 'á' as something like \207 and then an annoying prompt appears so I can choose another encoding but none seems to work.

If I disable simpleclip-mode ⌘ + V gives the right result.

The following is what the prompt informs me. Is it missing something on my default coding systems?

These default coding systems were tried to encode text
in the buffer ‘TODOs.org’:
(utf-8-emacs-unix (821 . 4194200) (854 . 4194183) (957 . 4194194)) (utf-8-unix
                                                                    (821 . 4194200) (854 . 4194183) (957 . 4194194))
However, each of them encountered characters it couldn’t encode: 
utf-8-emacs-unix cannot encode these: \230 \207 \222
utf-8-unix cannot encode these: \230 \207 \222
rolandwalker commented 4 years ago

Hi! What version of Emacs?