I'm working with Clojure code in Windows.
If I directly use Clojure's jar file, it outputs a non-ASCII (Japanese) string without problems.
hello.clj:
(println "こんにちは")
> java -jar 1.5.1.jar hello.clj
こんにちは
But in the case of a Leiningen project, it doesn't output the characters as expected.
src/hello/core.clj:
(defn -main [& args]
(println "こんにちは"))
> lein run
????????
In both cases, the encoding of the source files is UTF-8
, the class of *out*
is java.io.OutputStreamWriter
, and its encoding is MS932
(code page for Japanese).
(println "*out* :" (class *out*) (.getEncoding *out*))
;; *out* : java.io.OutputStreamWriter MS932
I know it will work correctly if I set the environment variable JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8
and use a terminal that supports UTF-8.
But I want to output with MS932
in Windows' default console, as in the jar file case.