4

How can store latin characters in appengine? (e.g. "peña") when I want to store this I get this error:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xf1 in position 2: ordinal not in range(128)

I can change the Ñ by N, but, there not another and better way?

And if i encode the value, how can print "Peña" again?

Kristian Damian
  • 1,360
  • 3
  • 22
  • 43

2 Answers2

2

GAE stores strings in unicode. Perhaps encode your string in unicode before saving it.

value = "peña"

value.encode("utf8")
Brian M. Hunt
  • 81,008
  • 74
  • 230
  • 343
0

From the error ("Unicode Decode Error"), it seems you could have more luck using Unicode - I'd try UTF-8.

Piskvor left the building
  • 91,498
  • 46
  • 177
  • 222