Re: arabic text insertion problem
You did not specify a character set when connecting. Here's an example script, note the charset when connecting:
# -*- coding: utf8 -*-
#import MySQLdb as my
import mysql.connector as my
if __name__ == '__main__':
db = my.connect(user='root',db='test',charset='utf8')
cur = db.cursor()
s = "INSERT INTO animal (name, category) VALUES ('a', '\xd8\xb6')"
cur.execute(s)
cur.execute("SELECT * FROM animal")
rows = cur.fetchall()
for row in rows:
print row[1].encode('utf-8')
cur.close()
db.close()
"""
+------+----------+
| name | category |
+------+----------+
| a | ض |
+------+----------+
"""
Geert Vanderkelen
Software Developer at Oracle
Subject
Written By
Posted
February 21, 2010 03:28AM
Re: arabic text insertion problem
February 22, 2010 06:52AM
February 24, 2010 04:22AM
February 24, 2010 04:44AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.