JShell language encoding in DOS/Windows - 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?

try
chcp 1253 && jshell

Related

Russian symbols works wrong

In my command line it doesn't show Russian symbols correctly. Scary symbols instead.
I think I should change character set, but how can it be done? Can anyone help me with this problem?
I think this command should help you if you work on Windows:
chcp 65001
This command changes character set of command line to UTF-8.

Q: How do you Display Chinese characters in command prompt

Is it possible to display chinese characters in command prompt? if so what are the settings.
If you need to read simplified Chinese (GBK) which is code page 936
Enter the following command in the dos prompt
chcp 936
I guess it's some settings in CMD
the default CMD doesn't support the unicode characters(including all other languages than English)
I don't know how to do it
But you can search about it "make CMD support unicode"

IntelliJ IDEA Terminal Special Characters

I recently started using IntelliJ IDEA Ultimate on Windows 10 and would really like to use the integrated terminal.
However, I can't get it to work with special characters like german umlauts or something like §.
That wouldn't be a problem if i hadn't some folders starting with Ü which i can't rename because they are part of a version control repo.
Because of that, i can't cd into these folders.
For example, an "ü" keystroke shows as "3R" and a "§" keystroke shows as "?" (like most special chars).
It neither works with the default terminal setting (cmd.exe) nor with git bash.
Has someone encountered a similar problem / has a solution for that?
I have had similar issues with IntelliJ Ultimate on Windows 10, regarding language and encoding on the Git Bash integrated Terminal. It was solved by setting the environment variables for the integrated terminal with the correct language. It can be done as follows:
Go to Settings
Terminal
Environment variables
Set two variables: LC_ALL=YOUR_LANGUAGE.utf8;LANG="$LC_ALL", where YOUR_LANGUAGE is the language code for the desired language. I searched a little and I think the correct one for German Umlauts is: de_DE.utf8. So, the configuration line would be:
- LC_ALL=de_DE.utf8;LANG="$LC_ALL"
Maybe you can set the file encoding by adding
-Dfile.encoding=UTF-8
to the idea64.vmoptions configuration file.

How can I set my GHCi prompt to a lambda character on Windows?

I want to have a lambda (λ) symbol as my prompt in GHCi (7.8) on Windows 7, so I set up my .ghci file as
:set +m
:set prompt "λ: "
:set prompt2 " | "
And I set my console font to Lucida Console since it's supposed to support Unicode, but when I load up GHCi, it looks like this instead
How can I get Windows to recognize the λ symbol properly?
Using > chcp.com 65001 worked with GHCi but opening other text files with Vim after setting that encoding returned garbled text.
Add the following to your %USERPROFILE%\.ghci. Instead of changing the encoding, you can use the Unicode escaped lambda \x03BB:
:set prompt "\x03BB: "
If %USERPROFILE%\.ghci does not exist, create it first before making the change.
This is actually quite a simple fix, just run the following command before starting GHCi:
> chcp.com 65001
This sets Window's encoding to the 65001 code page, which lets the λ get displayed properly:
This will also let a lot of other Unicode characters be displayed properly in cmd.exe and other Windows shells (such as Cygwin bash), but Windows' Unicode support is still not perfect, and some fonts don't support many of the characters. Luckily, λ happens to be a supported character so we can all have the classic GHCi prompt.
Using Răzvan Flavius Panda's answer, I decided to make a configuration file that had three flags for setting the prompt. The reason for this is prompt-cont is for GHCi versions >= 8.2.0, whereas prompt2 is for older GHCi versions.
I had a look at a short tutorial about configuring GHCi to try and find out where to put the configuration file. The site says that GHCi reads configuration files in the following order:
./.ghci (Local configuration file.)
Depending on your OS:
*nix: $HOME/.ghc/ghci.conf
Windows: C:\Users\<name>\AppData\Roaming\ghc\ghci.conf
$HOME/.ghci (Possibly *nix only; didn't work for me.)
I chose the second option.
C:\Users\Edwin\AppData\Roaming\ghc\ghci.conf:
:set prompt "\x03BB> "
:set prompt2 "\x03BB| "
:set prompt-cont "\x03BB| "
Explanation:
\x03BB stands for λ.
prompt is the main prompt. So it'll be "λ> ".
prompt2 is for a secondary prompt (I haven't seen it yet). So it'll be "λ| ".
prompt-cont is the same as prompt2, and is a replacement for prompt2 in GHCi 8.2.0.

Ruby display unicode character

I'm trying to print out some Unicode characters:
# encoding: utf-8
puts "ử ậ ắ ặ ố ồ"
If I run it through Powershell, this is what I get:
If I run it through cmd, this is what I get:
If I run it in Eclipse (with Aptana Studio 3 plugin), this is what I get:
Is it a problem with my system/software or is it Ruby's problem? How can I get it to work?
It works on Ideone though: http://ideone.com/PdycKH
Ruby supports it no problem, and setting the formatting at the top of the file is the way to go.
The issue is the display via the command line window. You need to use both a font and character page that supports Unicode display.
See this question regarding doing this in the Windows command line.
About the chcp command
I figured it out:
For cmd and Powershell, I have to change the font (I changed to Consolas)
In Eclipse, I have to change the encoding: go to Run/Run configurations, select the Common tab, change the Encoding to Other: UTF-8

Resources