views:

18

answers:

2

Hello, django newbie here,

I'm trying to insert a foreign language characters into a django model, and get this warning: *Incorrect string value: '\xD7\x90\xD7\x9E\xD7\xAA...' for column 'first_name' at row 1*

What should I do to solve this?

A: 

Try to insert the unicode value of the string, such as:

>>> a="\xD7\x90\xD7\x9E\xD7\xAA"
>>> a.decode('utf8')
u'\u05d0\u05de\u05ea'
adamk
Actually I needed to change the encoding of the database..
apple_pie
A: 

Django uses Unicode. Just use unicode literals.

u'\xD7\x90\xD7\x9E\xD7\xAA...'
S.Lott
Actually I needed to change the encoding of the database..
apple_pie