Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check encoding of a CSV file

Tags:

csv

encoding

I have a CSV file and I wish to understand its encoding. Is there a menu option in Microsoft Excel that can help me detect it

OR do I need to make use of programming languages like C# or PHP to deduce it.

like image 946
Vipul Avatar asked May 12 '16 04:05

Vipul


People also ask

How do I check encoding in Excel?

Go to the Data tab and select “From Text”. The text import wizard dialogue will open. With current encoding, the file content is unreadable. In the “File origin” field, we look through the encodings until we find the one where the text is displayed correctly.

What is the default encoding for CSV?

Exporting to CSV uses a default encoding of Unicode (UTF-16le).


2 Answers

You can use Notepad++ to evaluate a file's encoding without needing to write code. The evaluated encoding of the open file will display on the bottom bar, far right side. The encodings supported can be seen by going to Settings -> Preferences -> New Document/Default Directory and looking in the drop down.

like image 128
CamW Avatar answered Oct 12 '22 18:10

CamW


In Linux systems, you can use file command. It will give the correct encoding

Sample:

file blah.csv

Output:

blah.csv: ISO-8859 text, with very long lines
like image 73
Jitender Kumar Avatar answered Oct 12 '22 17:10

Jitender Kumar