Java 對Proporties檔案讀寫時,出現亂碼的解決辦法

來源:互聯網
上載者:User

   在做Java項目時,涉及到Proporties檔案時,總是頭痛,生怕出現亂碼的問題。下面介紹一種比較好用的方法來解決問題。

   在你的JDK目錄下bin檔案夾有一個應用程式native2ascii.exe,它就是用來解決亂碼問題的。

   1.  具體寫法:(注意 Constant.properties.GBK  和 Constant.properties  這兩個檔案發在同級目錄下)

       native2ascii -encoding utf-8 源檔案 目標檔案

       native2ascii -encoding utf-8 Constant.properties.GBK Constant.properties

 

  上面這句話可以寫成.bat 批次檔來執行。

  2.  還可以下載eclipse utf8的外掛程式進行安裝。安裝完外掛程式你的properties檔案會變成綠色的。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.