remvee/elein

utf-8 support

Closed this issue · 4 comments

you can run `lein swank' like this:

lein swank 4005 localhost :encoding '"utf-8"'

where the last argument is the string "utf-8" within single quotes (the argument must be passed to clojure where it is evaluated as a string, hence the double quotes, and these quotes must be protected from the shell, so we put them inside single quotes)

if you set the variable slime-net-encoding-system in emacs to 'utf-8-unix, utf-8 is working.

I extended elein.el to support this, I will send you a patch soon.

What problem will this solve? Can you give me a step-by-step recipe on how to reproduce the apparent problem?

Sure.

In emacs:

(setq slime-net-encoding-system 'utf-8-unix)
M-x elein-swank (in a directory where project.clj resides)

user> "árvíztűrő tükörfúrógép"

(or any other string which contains unicode code points - this one is a phrase used in hungarian to test encoding problems because it has all the accented characters used by the hungarian language)

the slime-repl clojure buffer shall have an UTF-8 encoding (this is taken care of by the slime-net-encoding-system variable)

after pressing Enter (sending the string for evaluation to swank), slime hangs.

With the fix I sent to you (swank started with :encoding '"utf-8"' option) this doesn't happen. I suppose some kind of character set conversion kicks in somewhere in the depths and that breaks the slime/swank protocol when one side uses a different encoding than the other.

The important thing is that the slime-net-encoding-system variable on the Emacs side and the :encoding option to lein swank should be set to corresponding values.

Thanks! I've added a customization variable to allow passing options to swank instead of a customization for encoding. It defaults to the encoding arguments you provided. See commit 2e0190f.

Your solution is beautiful (and the right way to solve this). Thank you.