hawk
hawk

Reputation: 21

JShell language encoding in DOS/Windows

I'm encountering the issue of having jshell not displaying non-english letters on MS-Windows. On Linux and Mac jshell behaves correctly.

In a DOS window, I try to enter Greek letters, e.g.:

jshell> var s = "Γειά"  

but I can only see

jshell> var s = "????"  

I thought that it had to do with the locale or character set.

C:\> chcp  
437   

so I changed it to UTF-8

C:\> chcp  
65001  

hoping that this would fix the problem, but alas. Please note that in DOS (outside of jshell) I can type Greek letters without an issue.

Even the JShell from inside NetBeans doesn't like non-English letters:

[1]-> var s = "Γειά σου";  
|  s ==> "???? ???" 

So I was wondering if there is some way to set the encoding in JShell itself.

Please note that this behaviour exists only in JShell on Windows. The OS locale has been changed to support the Greek language. However, JShell doesn't want to comply.

Has anybody encountered similar behaviour trying to display letters in JShell Windows from another alphabet?

Upvotes: 2

Views: 784

Answers (2)

isapir
isapir

Reputation: 23503

You need to set the JAVA_TOOL_OPTIONS environment variables, e.g.

JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 && jshell

But in Linux systems you need to use EXPORT, so

export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 && jshell

Upvotes: 0

virxen
virxen

Reputation: 438

try

chcp 1253 && jshell

Upvotes: 1

Related Questions