无法在命令提示符下处理特殊字符 [英] Unable to process special character on command prompt

查看:64
本文介绍了无法在命令提示符下处理特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在Windows命令提示符下执行特殊字符时,无法处理Java文件中的特殊字符,例如(–,',£等)。



示例:

 公共类HelloWorld {
public static void main(String [] args){
系统。 out.println(印度芒果–普通芒果);
}
}

预期产量:印度芒果–普通芒果 p>

接收到的坚果:芒果芒果



我相信这是某种unicode问题,我非常非常想在命令提示符下运行它,有没有办法对其进行排序?

解决方案

我想上面的解决方案提到的问题是将Windows命令提示符字体设置为consola并激活代码chcp 65001,这对我有用。


I am unable to process special characters such as (–, ', £ etc) in a java file when i try executing them on windows command prompt.

Example:

public class HelloWorld {
   public static void main(String[] args) {
     System.out.println("Mangifera indica – the common mango");
   }
}

Expected Output: Mangifera indica – the common mango

Ouput Recieved: Mangifera indica ΓÇô the common mango

I believe it is some sort of unicode problem, and i very much want to run it on the command prompt, is there a way it could be sorted?

解决方案

I guess the solution to above mentioned problem is to set the windows command prompt font to consola and activate code chcp 65001, worked for me.

这篇关于无法在命令提示符下处理特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆