nus-cs2113-AY2122S1 / forum

3 stars 1 forks source link

UTF-8 symbols on windows terminal? #119

Open Rrraaaeee opened 2 years ago

Rrraaaeee commented 2 years ago

Hi guys, we are currently using some unicode symbols to beautify our command prompts. But it seems that windows cmd / powershell do not use unicode encoding by default. Does anyone have idea on how we could configure the terminal encoding from within a java application? Thanks for the help!

qqkoh commented 2 years ago

Go to Run/Debug Configurations. Under -VM options put "-Dfile.encoding=UTF-8". When you run it on Intellij and there are still random wrong characters even though most of the UTF-8 characters appear correctly, create a jar file and run it on command prompt. All the UTF-8 characters should appear correctly. image

Rrraaaeee commented 2 years ago

Appreciate your suggestion. Will try it out!

okkhoy commented 2 years ago

@Rrraaaeee word of caution, if there is anything that you require the end-user to do (i.e., the tester) e.g., to enable Unicode on the terminal, you must always assume that the user will not do it for you! (It may not be with malicious intent, but in the PE time-constrained pressure, it may just get missed) Hence, those things may be marked as bugs, which should be accepted. On how to handle: