October 31, 2013

Convert text files between character sets

Hello Friends,

I was trying to upload the Bulk data from Flat text file to SQL Table, but it was required to have character sets as ANCII.. but when we manually change some data in text file it is keeping first column first value as null..

So after spending time on it, I found that file has to be converted to ANCII format..

Here is the commands for same..

On Windows with Powershell:

PS C:\> gc -en utf8 'in.txt' | Out-File -en ascii 'out.txt'

(No ISO-8859-15 support though; it says that supported charsets are unicode, utf7, utf8, utf32, ascii, bigendianunicode, default, and oem.)

CsCvt - Kalytta's Character Set Converter (http://www.cscvt.de) is another great command line based conversion tool for Windows.


Enjoy...