Converting UNICODE to shiftJIS

user2490003 picture user2490003 · May 9, 2014 · Viewed 7.5k times · Source

I have a Japanese client and have generated a large flat file (1.2 million rows) of data to send to them.

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.

  1. From the wikipedia page I can get the conversion logic
  2. 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?

Thanks!

Answer

vipin8169 picture vipin8169 · Mar 31, 2016

No need for any tool or utility, just use the gedit to convert your files. Follows the steps mentioned below:

  1. Open your file in gedit which you wish to convert, whatever format it may be in.

  2. Copy all the contents of the file and paste in a new gedit document.

  3. Now, save the file. In the save dialog thus opened select the character encoding as SHIFT_JIS before saving your file, attached is the screenshot below for this: enter image description here Change the line ending if you want to. If you do not see the SHIFT_JIS in the select options, then click on the Add or Remove button which is present just below it.

  4. In the dialog thus opened, select the SHIFT_JIS from the available encodings in the left column and then click on the Add button. Once added to the encoding menu, select it and save it. enter image description here