Home:ALL Converter>How to save urdu language characters in a csv file?

How to save urdu language characters in a csv file?

Ask Time:2018-09-25T00:47:04         Author:Tayyab Vohra

Json Formatter

I am trying to save urdu in csv file but symbols are stored in the file rather than urdu text also i have tried to add the iso code for urdu encoding but it is not working ISO-8859-1

import sys
import json
import time
import csv
import codecs

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
tweets = api.search(q="اردو"+" -filter:retweets",count="10000")
for tweet in tweets:
  if tweet.lang == "ur":
    #print(tweet.text)
    with open('mytweets18.csv', 'w', encoding='ISO-8859-1') as f:
     writer = csv.writer(f, delimiter=';')
     writer.writerow(tweet.text)

The problem is with encoding. I have also tried with encoding="utf-8", but both are not working. Need help regarding this.

Author:Tayyab Vohra,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/52483943/how-to-save-urdu-language-characters-in-a-csv-file
yy