App Engine Development Server Encoding

Is it possible to set UTF-8 encoding on dev-server? Everything works fine on the external (Google) server, but on the local server I get "???????" instead of the real characters in the Datastore Viewer.

+4
source share
1 answer

In GAE Python, to save the utf-8 string to the data store, you need to do two thoughts.

1 / Add headers at the top of your files:

The first one is for agreement, and the second one sets the entire contents of your file in utf-8 by default.

#!/usr/bin/env python # -*- coding: utf-8 -*- 

2 / Decode your utf-8 string to save the unicode string in the data store.

 my_value="çéè!§ç!éàèàçèéàçè(à" instance = mydatastore(mySavedUnicodeString=my_value.decode("utf-8")) user_instance.put() 
0
source

All Articles