-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unreadable codes when dealing with chinese. #6
Comments
Thanks for catching this and figuring out how to fix it! I'll put out an update shortly. |
Not sure what settings I may have that are different, but for the latest version this is still failing for me - Windows/Emacs24 - inserts ? in place of Chinese character |
GNU Emacs 25.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.20.9) of 2016-09-18 Russian paste as |
any suggestions? |
Okay thanks for the report - I'll see if I can make any headway on it tonight. I need to dig into Emacs some more - the |
Hi @bburns I've downloaded this excellent product more then year ago, but were unable to use it due to encoding issues - OK, it worked perfectly well when I used English only, but as soon as I use Russian, Ukrainian or some other languages it inserted ??? instead of characters. I've digged around and replaced one function to another function (which claims to do 'decode' in place: "The return value is already decoded". I am not 100% sure that my fix is right everywhere, but it works well on my emacs 27 at least. I will publish pull request. Please check. |
Thanks for the patch, @avkoval - I'll see if I can make a table of Emacs versions, platforms, etc., and good handlers for them - I'll have to rely on user reports for fixes as I can't test all the combinations... ;; Get a selection value of type TYPE by calling gui-get-selection with
;; an appropriate DATA-TYPE argument decided by `x-select-request-type'.
;; The return value is already decoded. If gui-get-selection causes an
;; error, this function return nil.
(defun gui--selection-value-internal (type)
(let ((request-type (if (eq window-system 'x)
(or x-select-request-type
'(UTF8_STRING COMPOUND_TEXT STRING))
'STRING))
text)
(with-demoted-errors "gui-get-selection: %S"
(if (consp request-type)
(while (and request-type (not text))
(setq text (gui-get-selection type (car request-type)))
(setq request-type (cdr request-type)))
(setq text (gui-get-selection type request-type))))
(if text
(remove-text-properties 0 (length text) '(foreign-selection nil) text))
text)) |
Aha, thats great that you are actively maintaining and answering those issues! :-) I would like to help you with it:
I can compile all emacs versions (24.x, 25.x, 26.x, 27.x my current) and try to release patch which will satisfy all of them (at least for Linux). I will find some time to do that. And thank you for excellent product! 👍 |
When i copy and paste chinese chars, the result will be some unreadable codes. I fixed it by replacing (x-get-selection 'CLIPBOARD) with (x-get-selection 'CLIPBOARD 'UTF8_STRING) in clipmon--clipboard-contents. I don't know whether this is appropriate.
The encoding problem only exists on linux, everything works fine on windows.
Great job though.
The text was updated successfully, but these errors were encountered: