ava項目中.properties中文資源文件相關資料
怎樣制作*_zh_CN.properties 中文資源文件。
原文網址:http://www.java3z.com/cwbwebhome/article/article2/2377.html?id=1033
利用程序native2asci.exe,它在JDK/BIN 目錄下,使用格式:
native2ascii [-reverse] [-encoding encoding] [inputfile [outputfile]]
正轉:To:Unicode
native2ascii -encoding gb2312 source.properties target.properties
反轉:Reverse Unicode To 指定碼
native2ascii -reverse -encoding Big5 source22.properties target2.properties
當然可以寫成批處理文件.bat自動轉化
1 先寫系統變量,要將native2asci.exe放到path路徑中:
set path= c:\jdk1.5\bin;...
2 建一個run.bat文件
del ApplicationResources_zh_CN.properties
native2ascii -encoding gb2312 beyond.properties ApplicationResources_zh_CN.properties
3.例子:C:\Tomcat 5.0\webapps\strutsjb9\WEB-INF\classes\beyond.properties
error.login.username=<li>不存在該用戶名
error.login.nullusername=<li>用戶名不能為空
error.login.password=<li>密碼錯誤
errors.footer=</font></ul>
errors.header=<ul><font color="red">
將run.bat文件復制到C:\Tomcat 5.0\webapps\strutsjb9\WEB-INF\classes\下,并運行!
然后你再打開ApplicationResources_zh_CN.properties 就看到效果了
===============
一個簡便好用的插件:
源代碼才50K的eclipse中文properties編輯插件
原文網址:http://www.tkk7.com/lifesting/archive/2008/03/31/189772.html
相關下載:本站下載中心
---------------
源代碼才50K的eclipse中文properties編輯插件
下載插件源代碼(eclipse 3.3)
下載eclipse 3.2 binary下載后改后綴zip為jar,然后放到eclipse/plugins目錄
eclipse內置一個properties
editor但是只支持latin-1編碼,調用native2ascii太麻煩,sourceforge上有一個很強大的properties
editor,日本人搞得,肯定支持中文了,但是版本太老,3.1,還有很多沒有什么多大用處的swing,
jbuild支持等,我稍微改了一下,做了一個最小化的編輯器。
嚴正申明,此軟件屬于研究性質,版權屬于原作者:http://propedit.sourceforge.jp/index_en.html
效果:
下載后將工程導入到workspace中,export成plugin即可。
======================
Java Properties 文件中文亂碼 Eclipse
原文網址:http://blog.chinaunix.net/u/29351/showart_654038.html
Java Properties 文件中文亂碼 Eclipse
在使用Java Properties讀取properties文件時中文是亂碼
原因是由于Java Properties的load方法讀取文件內容是使用的是 ISO 8859-1 字符編碼;也就是每個字節是一個 Latin1 字符。
解決辦法,我在網上看到,,有的說要用jdk到native2ascii進行編碼轉化,
我也轉了,還是不行.可能是由于我的project使用的UTF-8,轉換時還要制定參數,我也沒深研究
在網上找到的另個方法是使用Eclipse的插件:_Poperties Editor
--------------<一下摘自http://lam.javaeye.com/blog/158710>---------------
安裝方法:在線安裝Poperties Editor
啟動eclipse,點菜單Help -> SoftWare Updates -> find and install->
選中Search for new features to install ->next->點擊 New Remote site
->給這個更新站點取個名字 如:propedit,url填寫http://propedit.sourceforge.jp/eclipse/updates即可。
->點擊ok->選中剛才新加的站點名稱,點擊finish
->他會自動找出與你所用的eclipse版本相適應的插件全部選中->后面只要選擇install all即可
->最后會提示你重起你的eclipse
所有的properties文件名的前面都有一個綠色的p字
----------------------------------------------
一個不必再使用native2ascii編碼的eclipse插件
原文網址:http://opas.javaeye.com/blog/165560
和大家分享一個不錯的編寫properties文件的Eclipse插件(plugin),有了它我們在編輯一些簡體中文、繁體中文等Unicode文本
時,就不必再使用native2ascii編碼了。您可以通過Eclipse中的軟件升級(Software Update)安裝此插件,步驟如下:
1、展開Eclipse的Help菜單,將鼠標移到Software Update子項,在出現的子菜單中點擊Find and Install;
2、在Install/Update對話框中選擇Search for new features to install,點擊Next;
3、在Install對話框中點擊New Remote Site;
4、在New Update Site對話框的Name填入“PropEdit”或其它任意非空字符串,在URL中填入http://propedit.sourceforge.jp/eclipse/updates/;
5、在Site to include to search列表中,除上一步加入的site外的其它選項去掉,點擊Finsih;
6、在彈出的Updates對話框中的Select the features to install列表中將所有結尾為“3.1.x”的選項去掉(適用于Eclipse 3.2版本的朋友);
7、點擊Finish關閉對話框;
8、在下載后,同意安裝,再按提示重啟Eclipse,在工具條看到形似vi的按鈕表示安裝成功,插件可用。此時,Eclpise中所有properties文件的文件名前有綠色的P的圖標作為標識。
========================
如何在ApplicationResources.properties中輸入中文
原文網址:http://www.diybl.com
1.在你的ApplicationResources.properties文件目錄里新建一個a.txt文件
2.打開cmd
3.輸入native2ascii
4.進入到ApplicationResources.properties文件所在目錄
5.運行: native2ascii a.txt ApplicationResources.properties
這樣就可以得到a.txt文件里中文的Unicode碼文件----ApplicationResources_new.properties。也就是說
你可以直接在a.txt里寫入,修改中文,然后在如上編輯一次a.txt文件,即可在
ApplicationResources_new.properties文件中一次性寫入中文的Unicode碼。
還可以運用 native2ascii -encoding gb2312 命令還能將其轉換為其他字符格式。
還有一個一個Eclipse的properties文件的插件,update sites里加一項。
PropertiesEdtior http://propedit.sourceforge.jp/eclipse/updates/ 可以自動轉化。