将UNICODE转换为shiftJIS [英] Converting UNICODE to shiftJIS
问题描述
我有一个日语客户端,并生成了一个大型平面文件(120万行)的数据发送给他们。
I have a Japanese client and have generated a large flat file (1.2 million rows) of data to send to them.
该文件采用UTF-8编码,支持存储和显示所有日语字符。
The file is UTF-8 encoded, which supports storing and displaying all the Japanese characters. The client wishes to receive this file in a shiftJIS encoded format that's designed for Japanese characters.
- From the wikipedia page I can get the conversion logic
- I see online converters such as motobit that let you convert encodings.
我的问题是我的文件相当大,我将不得不这样做数百个文件重复。
My issue is that my file is quite large and I will have to do this for several hundred more files repetitively. The copy-paste field on the online converter tool won't scale to that size and isn't quick enough.
有人知道一个免费的桌面应用程序,甚至是一个免费的桌面应用程序,一个红宝石库,我可以用来转换编码?或任何其他建议?
Does anyone know of a free desktop application or perhaps even a ruby library that I could use to convert encodings? Or any other suggestions?
谢谢!
推荐答案
你想要的可能是 nkf
,网络汉字过滤器。
I guess what you want might be the nkf
, Network Kanji Filter.
您可以将文件从utf-8转换为shift-jis,如下所示:
You can convert a file from utf-8 into shift-jis like this:
% nkf -s file-utf8.txt > file-sjis.txt
手册页:
http://linuxcommand.org/man_pages/nkf1.html
维基百科:
http://en.wikipedia.org/wiki/Network_Kanji_Filter
您可以这样安装nkf:
You can install nkf like this:
% sudo yum install nkf
% sudo port install nkf
% brew install nkf
这有助于。
这篇关于将UNICODE转换为shiftJIS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!