I have written a python script which get data from database and process it.
Initially I was using pymysql for connecting database which I changed to MySQL Connector for python. When I started using MySQL Connector I am getting following issue
'ascii' codec can't encode characters in position 14-16: ordinal not in range(128)
I tried by adding charset settings of MySQL Connector but issue still persists.
Do anyone have idea on this issue?
ascii
encodingExample:
assci
encoding and enable unicodedb = MySQLdb.connect( host="localhost", port=3306, user="john", passwd="megajonhy", db="jonhydb", use_unicode=True, charset='ascii' )
I believe that by default
use_unicode
is set toFalse
, and thus by setting itTrue
you will fix the issue.