Skip to content
Advertisement

How to save Farsi text in csv file using python?

I was trying to save my dataset in a CSV file with the following script:

JavaScript

but the result is confusing, write some unknown chars to CSV file instead of Farsi chars: Can anyone help me?

I want to write all these files in a CSV: enter image description here example of what I have in one of them and want to write:

JavaScript

but result:

enter image description here

Advertisement

Answer

To add to Cimbali’s answer, another method to add a UTF8 BOM is by using the encoding “utf-8-sig” instead of “utf-8”, as it will automatically take care of it for you.

Further information is in this question: Unable to Save Arabic Decoded Unicode to CSV File Using Python

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement