Comments on: How to Convert Files to UTF-8 Encoding in Linux https://www.tecmint.com/convert-files-to-utf-8-encoding-in-linux/ Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks. Thu, 13 Jul 2023 15:22:49 +0000 hourly 1 By: Antonio https://www.tecmint.com/convert-files-to-utf-8-encoding-in-linux/comment-page-1/#comment-1577872 Wed, 01 Sep 2021 19:53:17 +0000 http://www.tecmint.com/?p=23273#comment-1577872 Thank you very much, this was exactly what I was looking for!

]]>
By: Preethi Nair https://www.tecmint.com/convert-files-to-utf-8-encoding-in-linux/comment-page-1/#comment-1483580 Thu, 29 Apr 2021 11:29:54 +0000 http://www.tecmint.com/?p=23273#comment-1483580 Hi,

While converting a csv file to UTF8, using the below command I am getting the error like:

iconv: illegal input sequence at position 5857689

Command :

$ iconv -f ASCII -t UTF-8 EDMTradesFeed_20210428.csv -o EDMTradesFeed.csv

What would have gone wrong here? Can you please help?

Thanks

]]>
By: suresh https://www.tecmint.com/convert-files-to-utf-8-encoding-in-linux/comment-page-1/#comment-1391619 Wed, 18 Nov 2020 18:39:01 +0000 http://www.tecmint.com/?p=23273#comment-1391619 In reply to Aaron Kili.

It is failing with huge files. Is there a way to avoid data loss?

]]>
By: Manjeet https://www.tecmint.com/convert-files-to-utf-8-encoding-in-linux/comment-page-1/#comment-1203800 Mon, 15 Jul 2019 08:10:49 +0000 http://www.tecmint.com/?p=23273#comment-1203800 In reply to Aaron Kili.

Hi Aaron,

File is not that big, it is failing for number of records more than 700, and no of columns will be 5-7 and our file is having Latin America and Chinese data as well. We have done as below, Kindly suggest if we can discuss over google chat.

Our Script 
#!/bin/bash
cd $SRCFILEDIR

for f in *txt
do

encoding=$(file -b --mime-encoding $f)

        if [ utf-8 != $encoding ] && [ us-ascii != $encoding ] && [ binary != $encoding ]; then
                iconv -f $encoding -t utf-8 $f -o $f
        else
                echo $encoding
        fi
done 

We get below error :

us-ascii -- converted successfully
us-ascii -- converted successfully
binary -- converted successfully
./testing.sh: line 6:  1156 Bus error               (core dumped) iconv -f $encoding -t utf-8 $f -o $f
./testing.sh: line 6:  1161 Bus error               (core dumped) iconv -f $encoding -t utf-8 $f -o $f
]]>
By: Aaron Kili https://www.tecmint.com/convert-files-to-utf-8-encoding-in-linux/comment-page-1/#comment-1201771 Sat, 13 Jul 2019 07:07:47 +0000 http://www.tecmint.com/?p=23273#comment-1201771 In reply to Manjeet.

@Manjeet

How big is the file you are working with? The script should work with huge files.

]]>