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.