0

I am using the Neomodel library to bind my Neo4j database with Django framework. Trying to get an instance from my DB via local shell, I am getting an encoding error:

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)

How can I avoid this?

user3241376
  • 407
  • 7
  • 20
  • You are sure that you have your table with correct encoding ? `utf-8` ? – Silwest Jul 01 '14 at 10:43
  • PlaceName is a class: `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')` – user3241376 Jul 01 '14 at 13:07
  • But it's about your database for example for MySQL http://stackoverflow.com/questions/3832056/mysql-check-collation-of-a-table – Silwest Jul 01 '14 at 13:11
  • I use a graph-database, NoSQL, I don't have tables of this kind – user3241376 Jul 01 '14 at 13:18
  • But you still got to select some sort of encoding for your text data. If you didn't select I suggest you to look at the default encoding for that field and how to change it, to UTF8 preferably. – mehmetminanc Jul 01 '14 at 14:04

1 Answers1

0

Hmm ...

Can you please try this:

city = PlaceName.index.search(name=unicode('Zürich','utf-8'))
Silwest
  • 1,620
  • 1
  • 15
  • 29