我使用的金字塔和SQLAlchemy的,但下面的简化代码:的Unicode与金字塔,SQLAlchemy的
u = u"\u201C"
m = M()
m.comment = u
m.user_id = 1
session.add(m)
session.commit()
给了我一个
UnicodeEncodeError: 'latin-1' codec can't encode character u'\u201c' in position 0: ordinal not in range(256)
我需要做什么来解决这个问题?
编辑:
注释是 “MEDIUMTEXT” 一栏,MySQL的类型。
你能张贴类'M'的定义是什么? –