native2ascii 命令
native2ascii 是一個(gè)關(guān)于轉(zhuǎn)碼的不錯(cuò)的命令.使用條件簡(jiǎn)單,只要安裝了jdk之后,在cmd窗口就可以使用該命令對(duì)文件進(jìn)行轉(zhuǎn)碼,而且轉(zhuǎn)碼過(guò)程是可逆的.安裝路徑下bin目錄下,有一個(gè)native2ascii? 批處理文件也可以完成轉(zhuǎn)碼.
具體的語(yǔ)法如下:
native2ascii -[options] [inputfile [outputfile]]
-[options]:表示命令開(kāi)關(guān),有兩個(gè)選項(xiàng)可供選擇
-reverse:將Unicode編碼轉(zhuǎn)為本地或者指定編碼,不指定編碼情況下,將轉(zhuǎn)為本地編碼。
-encoding encoding_name:轉(zhuǎn)換為指定編碼,encoding_name為編碼名稱(chēng)。
-[inputfile [outputfile]]
inputfile:表示輸入文件全名。
outputfile:輸出文件名。如果缺少此參數(shù),將輸出到控制臺(tái)。
編寫(xiě)一個(gè)test.properties 文件.文件內(nèi)容為 userName = 用戶(hù)名 .放在D盤(pán)根目錄下.進(jìn)入cmd.
Test1.? 轉(zhuǎn)換編碼為uniocde,并輸出在控制臺(tái)上
D:\> native2ascii? test.properties
userName = \u7528\u6237\u540d
Test2. 轉(zhuǎn)換編碼為uniocde,并輸出新文件
D:\>native2ascii? test.properties message_Resouce_zh_CN_properties
Test3.反轉(zhuǎn)(test2.properties 又回到了test.properties 內(nèi)容)
D:\>native2ascii -reverse? message_Resouce_zh_CN_properties test2.properties
Test4 轉(zhuǎn)化到指定編碼(ISO8859-1)
D:>native2ascii -encoding? ISO8859-1 test.properties test3.properties
?
結(jié)論:native2ascii? 在國(guó)際化時(shí)非常有用.
總結(jié)
以上是生活随笔為你收集整理的native2ascii 命令的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: SpringBoot 配置多数据源(Sq
- 下一篇: mybatis学习(31):修改部分字段