4
votes

I have the following issue within a clojure repl on an aws ec2 instance (3.2.30-49.59.amzn1.x86_64) running inside of Tomcat 7:

user=> (println "Tiësto")
Ti�sto

Naturally, I verify that my file encoding is utf-8:

user=> (get (System/getProperties) "file.encoding")
"UTF-8"

... so far, so good. Maybe its a repl input problem, so I escape the input:

user=> (println "Ti\u00ebsto")
Ti�sto

... now I try to print it out to a log instead

user=> (info "Tiësto")
output from the log:
2013-03-30 19:04:06.569 INFO  default    user - Tiësto

Great! although this problem still persists when spitting "Tiësto" out through a ring handler:

{
 ...
  artists: ["Ti�sto"],
 ...
}

None of these issues occur in my development environment (of course). Anyone have some idea of what might be going on?

1
In case you are accessing the REPL with a browser, the browser might get the character encoding wrong. See document.characterSet in the web/javascript console. In Google Chrome, use Settings->Tools->Encoding - stackunderflow
It seems to be an environment issue rather than anything related to Clojure or JVM itself. Just check your locale on shell, it should yield something sensible like "en_US.UTF-8" - 0100110010101

1 Answers

0
votes

Have you tried to set the Content Type and Character Encoding:

response.setContentType("text/html;charset=UTF-8");  
response.setCharacterEncoding("UTF-8");  
out.println(Tiësto);