t*g
2 楼
中文文件里面有4个字"萨尔加多",utf-8 encoding.
下面是code
public static void main(String[] args) {
String queries="c:\\temp\\qauto.txt";
try{
BufferedReader in = new BufferedReader(new InputStreamReader(new
FileInputStream(queries),"UTF-8"));
String str=in.readLine();
System.out.println(str+"length"+str.length());
}catch(Exception e){
e.printStackTrace();
}
}
打印出来是5个字符。为什么?好像在第三个和第四个中间加了一个。eclipse的console
没法给我显示中文输出。谢谢!
下面是code
public static void main(String[] args) {
String queries="c:\\temp\\qauto.txt";
try{
BufferedReader in = new BufferedReader(new InputStreamReader(new
FileInputStream(queries),"UTF-8"));
String str=in.readLine();
System.out.println(str+"length"+str.length());
}catch(Exception e){
e.printStackTrace();
}
}
打印出来是5个字符。为什么?好像在第三个和第四个中间加了一个。eclipse的console
没法给我显示中文输出。谢谢!
c*p
3 楼
相看,帮顶!
k*r
4 楼
To display UTF-8 in eclipse, go to Run dialog, Common tab, Console Encoding,
set to utf-8
【在 t*g 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: 中文文件里面有4个字"萨尔加多",utf-8 encoding.
: 下面是code
: public static void main(String[] args) {
:
: String queries="c:\\temp\\qauto.txt";
: try{
: BufferedReader in = new BufferedReader(new InputStreamReader(new
: FileInputStream(queries),"UTF-8"));
: String str=in.readLine();
: System.out.println(str+"length"+str.length());
set to utf-8
【在 t*g 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: 中文文件里面有4个字"萨尔加多",utf-8 encoding.
: 下面是code
: public static void main(String[] args) {
:
: String queries="c:\\temp\\qauto.txt";
: try{
: BufferedReader in = new BufferedReader(new InputStreamReader(new
: FileInputStream(queries),"UTF-8"));
: String str=in.readLine();
: System.out.println(str+"length"+str.length());
z*7
5 楼
我现在假设我就是你说的哪个老周哈.
我难道没有奔过吗?
我难道没有奔过吗?
s*g
7 楼
顶一个,特别好奇
相关阅读
免费拿 $100 Cash +$75 Ing Direct BonusIssue when running a unix command with Runtime.getRuntime.exec()包子求SCWCD考试练习题库Java EE 习题 1请教一个建网站的笔试题菜鸟请教个hadoop streaming job 的问题 (转载)Java练习题 11免费拿 $100 Cash +$75 Ing Direct Bonus有没有人IBM Tivoli Worklaod Scheduler API sample的package????java multi-threading issue比较trickyGUI问题有人用Grails吗interesting "protect" behaviormodify parameter, or return?Java练习题 12一个比较菜鸟的数据输入的验证问题..谢谢..JTable 问题 setAutoCreateRowSorter(true) 不工作JtextPane中英等宽字体问题java.lang.NullPointerException这种东西怎么知道是什么问题java 响应速度问题