CSV file with Arabic characters is displayed as symbols in Excel

情到浓时终转凉″ 提交于 2020-05-17 07:17:05

问题


I am using python to extract Arabic tweets from twitter and save it as a CSV file, but when I open the saved file in excel the Arabic language displays as symbols. However, inside python and notepad or word, it looks good. May I know where is the problem?


回答1:


This is a problem I face frequently with Microsoft Excel when opening CSV files that contain Arabic characters. Try the following workaround that I tested on latest versions of Microsoft Excel on both Windows and MacOS:

  1. Open Excel on a blank workbook

  2. Within the Data tab, click on From Text button (if not activated, make sure an empty cell is selected)

  3. Browse and select the CSV file

  4. In the Text Import Wizard, change the File_origin to "Unicode (UTF-8)"

  5. Go next and from the Delimiters, select the delimiter used in your file e.g. comma

  6. Finish and select where to import the data

The Arabic characters should show correctly.




回答2:


Excel is known to have an awful csv import sytem. Long story short if on same system you import a csv file that you have just exported, it will work smoothly. Else, the csv file is expected to use the Windows system encoding and delimiter.

A rather awkward but robust system is to use LibreOffice or Oracle OpenOffice. Both are far beyond Excel on any feature but the csv module: they will allow you to specify the delimiters and optional quoting characters along with the encoding of the csv file and you will be able to save the resulting file in xslx.



来源:https://stackoverflow.com/questions/60239099/csv-file-with-arabic-characters-is-displayed-as-symbols-in-excel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!