无法在命令提示符下处理特殊字符

编程入门 行业动态 更新时间:2024-10-26 06:30:16
本文介绍了无法在命令提示符下处理特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当我尝试在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.

更多推荐

无法在命令提示符下处理特殊字符

本文发布于:2023-11-06 17:21:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564310.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:命令提示符   特殊字符

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!