My problem is that SQLAlchemy seems to be writing the text not properly encoded in my Oracle database.
I include fragments of the code below:
engine = create_engine("oracle://%s:%s@%s:%s/%s?charset=utf8"%(db_username, db_password, db_hostname,db_port, db_database), encoding='utf8')
connection = engine.connect()
session = Session(bind = connection)
class MyClass(DeclarativeBase):
"""
Model of the be persisted
"""
__tablename__ = "enconding_test"
id = Column(Integer, Sequence('encoding_test_id_seq'),primary_key = True)
blabla = Column(String(255, collation='utf-8'), default = '')
autoload = True
content = unicode("äüößqwerty","utf_8")
t = MyClass(blabla=content.encode("utf_8"))
session.add(t)
session.commit()
If now I read the contents of the database, I get printed something like:
????????qwerty
instead of the original:
äüößqwerty
So basically my question is what do I have to do, to properly store these German characters in the database?
Thanks in advance!