Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Printing by
retagged by

The repro is very simple, note the correct with Java's println and incorrect ? with Clojure's println:

Clojure 1.10.3
user=> (.println System/out "abc\u2551")
abc║
nil
user=> (println "abc\u2551")
abc?
nil

3 Answers

+2 votes
by

Interesting, I have both correct in my case, in a fresh REPL started with just clj:

Clojure 1.10.3
user=> (.println System/out "abc\u2551")
abc║
nil
user=> (println "abc\u2551")
abc║
nil
+2 votes
by

I suspect the root cause of the difference might have to do with things like the operating system, the JDK version, whether the REPL is run inside of an IDE like VSCode with Calva, Emacs with CIDER, or at a terminal, and perhaps even environment variable settings used by the JVM for determining character sets like LC, LANG, TERM, etc. for macOS and Linux.

At least for macOS 10.14.6 built-in Terminal, AdoptOpenJDK 15.0.1, and a REPL started in that Terminal using clojure version 1.10.1.763 and the environment variable values below, I got the desired result:

$ env | egrep '(LC|LANG|TERM)' TERM_PROGRAM=Apple_Terminal TERM=xterm-256color TERM_PROGRAM_VERSION=421.2 TERM_SESSION_ID=51C20403-498A-4E4E-ABFE-B59367276B5D LANG=en_US.UTF-8

0 votes
by
edited by

Interesting :-), here is more info about my system:
OS: Windows 10, version 21H1
Java:
java version "1.8.0_311" Java(TM) SE Runtime Environment (build 1.8.0_311-b11) Java HotSpot(TM) Client VM (build 25.311-b11, mixed mode)
Terminals:
I've tried 4 different terminals: cmd, PowerShell, VS Code's built-in term and ConEmu. The same result on all 4.
I've also tried clj from PowerShell, lein trampoline run and direct java -jar uberjar invocation, it never works properly with Clojure's println and always works for Java's.

by
I have the same problem... on Windows 10 21H1, JDK 16, clj 1.10.3.
...