Juanse
Juanse

Reputation: 95

local dev server and app engine python utf 8

In building a website in GAE. I did most of the work in the dev server where I have a database. In my dev server I inserted the entities in UTF-8 because if I don't the values are not writen. However, this makes me have to use {{ nom.titre.encode("utf-8")}} in order to display them correctly with jinja2. I know that GAE datastore only uses UNICODE so I could anticipate the problem that I'm facing now.

So, I used appcfg.py download_data --url=http://localhost:8080/_ah/remote_api/ --filename=filename.csv --kind=-kind- to get a backup of my dev datastore.

Now the problem is when I try to update to the server.

Either I use :

OR

So, what is the most direct way to upload the info of my dev server datastore into the GAE datastore keeping the UTF-8 AND not changing the template encoding?

Upvotes: 0

Views: 506

Answers (1)

Sologoub
Sologoub

Reputation: 5352

When you store the strings, you should use decode('utf-8') and then encode for display purposes. You are currently doing this in the template, but you should be decoding the expected UTF-8 string when you are storing it.

Upvotes: 1

Related Questions