Open Cologler opened 6 years ago
may same as #209.
参考 #167 中这个回复:
我倒是发现了一个问题,win7 7601,vs code 1.18.1,code runner 0.8.3,设置code-runner.runInTerminal": false 是在输出窗口中进行输出,这时候python输出中文乱码,c和java正常,但是如果是code-runner.runInTerminal": true,则在终端中输出,python正常,c和java乱码。
~可能需要再修改成按语言配置不同的 encoding (我的 PR 目前只有添加了一个全局的 outputEncoding)。~ vscode 是支持按语义配置不同配置的。
运行java一堆messy code
[Running] cd "e:\java_files\StepSecond\src\" && javac ComicBooks.java && java ComicBooks
ע: ComicBooks.javaʹ����δ������ȫ�IJ�����
ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:unchecked ���±��롣
Title: Amazing spider-man
Issue: 1A
Condition: very fine
Price: $7500.0
l
Title: Incredible hulk
Issue: 181
Condition: coverless
Price: $24.0
l
Title: Cerebus
Issue: 1A
Condition: pristine mint
Price: $720.0
l
[Done] exited with code=0 in 7.951 seconds
@William-Python-King 什么意思?你这个输出是来自我的 pr 的版本?
如果是的话,你要在 vscode 的配置添加一行 "code-runner.outputEncoding": "gbk"
。这样就不是乱码了。
@Cologler 不是你的版本。coderunner还没修复这个问题,是不是要把其他编码的输出全部转换成utf-8编码来输出?
@William-Python-King 乱码产生的过程不是转换成 utf-8 来输出,而是 code-runner 从 cmd 中读 stdout 时候不应该按 utf-8 来读。如果你会看代码就直接看代码吧,也就三行的事情。
@formulahendry 加速 pr 合并
So your system locale is zh-cn? And do you need to set code-runner.outputEncoding
to GBK to fix the output issue?
@formulahendry yes.
@formulahendry yes, it's a problem.
@formulahendry vscode 支持特定语言配置的语法:
"[java]": {
"code-runner.outputEncoding": "gbk"
}
不过我没找到怎样 get
所以只实现了全局的。
如果是中文系统,那就会设置全局为gbk,应该不会需要根据不同语言设置不同的encoding吧
@formulahendry 也许吧……之后再看别人提的 issus 吧。😂
设置里的code-runner.executorMap下的"java"改成下面的然后保存就可以了,文件需要是UTF-8.
"java": "cd $dir && javac -encoding UTF-8 $fileName && java $fileNameWithoutExt",
python同样的改成下面的即可
"python": "cd $dir && set PYTHONIOENCODING=utf8 && python $fileName",
@symant233 Thanks its helps me!
I have the same problem with C++. How can I fix it? Also are there some way to set this property for all languages?
Does anyone know how to solve this encoding problem for c language?
i tried gcc -encoding UTF-8
but it didn't work
文件是GBK,code-runner.executorMap下的"java"里加了-encoding GBK还是�,settings.json里面加code-runner.outputEncoding显示“未知的配置设置”,版本0.12.2 (2024-04-05)
currently:
expect: