中文轉ascii

咱們在開發使時常會用到資源文件,這多是爲了多語言、國際化的須要,也多是使用了國外開源項目的緣由,這就須要中文轉ascii將中文轉換爲 ASCII 編碼,或者將 ASCII 轉換爲中文,那麼咱們就可使用 JDK 自帶的轉換工具 native2ascii 。 工具

for example : 編碼

No1 、中文轉換爲 ASCII 編碼 spa

步驟: 1 、在 D 盤新建   chinese.txt  文件,內容爲: ci

string= 這是中文 資源

2 、在環境變量中設置好 JDK 路徑 開發

3 、進入 doc 控制檯,並進入 D 盤目錄 string

4 、輸入命令: native2ascii   -encoding   gb2312   chinese.txt  ascii.txt  回車 it

那麼在 D 盤目錄下生成 ascii.txt 文件,內容爲: 變量

string=\u8fd9\u662f\u4e2d\u6ascii碼 中文587 coding

 

No1 、 ASCII 編碼轉換爲中文

步驟: 1 、在 D 盤新建   ascii.txt  文件,內容爲:

string=\u8fd9\u662f\u4e2d\u6ascii碼 中文587

2 、在環境變量中設置好 JDK 路徑

3 、進入 doc 控制檯,並進入 D 盤目錄

4 、輸入命令: native2ascii   -reverse   -encoding   UTF8   ascii.txt  chinese.txt  回車

那麼在 D 盤目錄下生成 chinese.txt 文件,內容爲:

parameter.project.title= 這是中文

相關文章
相關標籤/搜索