iT邦幫忙

0

出現再打apache netbeans ide 10.0 InputStreamReader 中文字無法

Tzu 2020-09-25 19:42:51774 瀏覽
  • 分享至 

  • twitterImage

https://ithelp.ithome.com.tw/upload/images/20200925/20119035lYZwdFvoaA.png
https://ithelp.ithome.com.tw/upload/images/20200925/201190359mbq5RMl61.png
https://ithelp.ithome.com.tw/upload/images/20200925/20119035n4teAgPlcS.png

我覺得不是程式碼的問題但還是一起貼上

import java.io.*;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author User
 */
public class WrapSyatemIn {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        System.out.print("請輸入一串字");
        InputStreamReader ir=new InputStreamReader(System.in);
        
        char[] ch =new char[80];
        int i=0;
        while( (ch[i]=(char)ir.read())!=10)
            i++;
        
        System.out.print("用InputStreamReader讀到的是:");
        for(int j=0;j<i;j++)
            System.out.print(ch[j]);
     System.out.println();
     
     System.out.print("請再輸入一串字:");
     BufferedReader br=new  BufferedReader(ir);
     String str=br.readLine();
     System.out.println("用BufferedReader讀到的是:"+ str);
    }
}

謝謝各位大大


找到答案
無法顯示中文
http://jimmychanitpro.blogspot.com/2018/07/netbeans-utf-8.html

在C:\Program Files\NetBeans 8.1\etc\netbeans.conf

增加-J-Dfile.encoding=UTF-8

fillano iT邦超人 1 級 ‧ 2020-09-25 20:15:50 檢舉
https://openhome.cc/Gossip/Encoding/JVMEncoding.html

這跟NetBeans沒關係。
Tzu iT邦新手 1 級 ‧ 2020-09-25 22:24:43 檢舉
謝謝大大 我解決了
會更新在上面
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答