【发布时间】:2014-08-21 20:58:38
【问题描述】:
我正在使用 Neomodel 库将我的 Neo4j 数据库与 Django 框架绑定。 尝试通过本地 shell 从我的数据库中获取实例,我收到编码错误:
city = PlaceName.index.search(name=u'Zürich')
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 1: ordinal not in range(128)
我怎样才能避免这种情况?
【问题讨论】:
-
您确定您的表格编码正确吗?
utf-8? -
PlaceName 是一个类:
class PlaceName(StructuredNode): name = StringProperty(index=True, required=True) lang = StringProperty(index=True, required=True) type = StringProperty(index=True, required=True) hasid = RelationshipTo('PlaceId', 'HAS_ID') descr = RelationshipTo('Desc', 'HAS_DESC') -
但它与您的数据库有关,例如 MySQL stackoverflow.com/questions/3832056/…
-
我使用图形数据库 NoSQL,我没有这种表
-
但是您仍然需要为您的文本数据选择某种编码。如果您没有选择我建议您查看该字段的默认编码以及如何更改它,最好是 UTF8。