obsidian-execute-code icon indicating copy to clipboard operation
obsidian-execute-code copied to clipboard

Can't display Chinese characters

Open Qinggao1729 opened this issue 2 years ago • 8 comments

My system language is Chinese, so if I run java file in windows terminal, it will display Chinese. But when I run it in obsidian, the Chinese characters can't be displayed normally. image image

I know there's a similar issue here #126 about printing Chinese characters, but my case is about displaying error messages. Is there any way to solve the issue?

Edit: I'm running Git Bash on windows11. Also, my system language is Chinese.

Qinggao1729 avatar Jan 24 '23 08:01 Qinggao1729

Interesting, thank you! :)

Could you try using the -DFile.Encoding=UTF-8 argument in the plugin settings?

image

chlohal avatar Jan 24 '23 22:01 chlohal

No, it doesn't work. image image

Qinggao1729 avatar Jan 25 '23 22:01 Qinggao1729

I think the issue is similar to this: https://stackoverflow.com/questions/28567208/how-can-i-change-the-standard-out-to-utf-8-in-java

The output stream is differently encoded than the text in Obsidian. Maybe we need to solve this globally by changing the encoding of every character before adding it to the output block in Obsidian.

twibiral avatar Jan 26 '23 12:01 twibiral

I think the issue is similar to this: https://stackoverflow.com/questions/28567208/how-can-i-change-the-standard-out-to-utf-8-in-java

The output stream is differently encoded than the text in Obsidian. Maybe we need to solve this globally by changing the encoding of every character before adding it to the output block in Obsidian.

Sorry, I don't understand. I want to change it to display the error message. Can it work too?

Qinggao1729 avatar Jan 29 '23 19:01 Qinggao1729

I see: it's not just the java std streams, but the javac ones too.

Would you mind entering the following command & sending a screenshot of the output? This will help get a grasp on the encoding that your system uses.

javac HelloWorld.java 2> /dev/stdout | xxd

chlohal avatar Jan 29 '23 23:01 chlohal

I see: it's not just the java std streams, but the javac ones too.

Would you mind entering the following command & sending a screenshot of the output? This will help get a grasp on the encoding that your system uses.

javac HelloWorld.java 2> /dev/stdout | xxd

image It prints nothing.

(I'm running Git Bash on windows11. Also, my system language is Chinese.)

Qinggao1729 avatar Jan 30 '23 00:01 Qinggao1729

Not sure if this is relevant: the error messages displayed on my IntelliJ was also Chinese originally, but I followed the instruction here to change it to English: https://stackoverflow.com/a/47529952/21070222

Qinggao1729 avatar Jan 30 '23 00:01 Qinggao1729

try this: https://stackoverflow.com/questions/57131654/using-utf-8-encoding-chcp-65001-in-command-prompt-windows-powershell-window

AINightCoder avatar Aug 05 '23 01:08 AINightCoder