pinard/Pymacs — Issue #20: unicode handling
Author: leoliu
Created: 2012-02-26 04:40:49+00:00
State: open

I ran into unicode problems this morning. I need to pass a file with unicode chars (Chinese in my case), and Pymacs cannot handle it.

I apply this patch and it is working.

--- pymacs.el2	2012-02-23 04:28:52.000000000 +0800
+++ pymacs.el	2012-02-26 12:10:55.000000000 +0800
@@ -506,7 +506,7 @@
(split-string (prin1-to-string text) "\n")
"\\n"))
(when multibyte
- (princ ".encode('ISO-8859-1').decode('UTF-8')")))
+ (princ ".decode('UTF-8')")))
(setq done t)))
((symbolp expression)
(let ((name (symbol-name expression)))

i.e. it removes the .encode('ISO-8859-1') bit.

My question is why encode it with ISO-8859-1 when the multibyte text has been previously decoded as utf-8 in emacs like this:

(encode-coding-string expression 'utf-8)

Isn't this contradictory?