title: Best way to save a dictionary which contains non-ASCII characters in Datastore with Python ndb
body: <p>I have this dict: <code>{'ª': 'a'}</code> and want to save it to ndb object.</p>
  <p>The superscript <code>ª</code> is a non-ASCII character.</p>
  <p>Initially I was saving the mapping as a json dump string. I had this class:</p>
  <pre><code>class MyClass:
    mapping = ndb.TextProperty()
  </code></pre>
  <p>And saving was doing something like:</p>
  <pre><code>obj = MyClass()
  obj.mapping = json.dumps({'ª': 'a'})
  </code></pre>
  <p>This was raising an error, because <code>dumps</code> (in Python 2.7) doesn't support non-ASCII chars.</p>
  <p>So, I tried to define different model:</p>
  <pre><code>class MyClass:
    mapping = ndb.JsonProperty()
  </code></pre>
  <p>and save like this:</p>
  <pre><code>obj = MyClass()
  obj.mapping = {'ª': 'a'}
  obj.put()
  </code></pre>
  <p>This fails during <code>obj.put()</code> with the following error:</p>
  <pre><code>utf8 codec can't decode byte 0xaa in position 1: invalid start byte
  </code></pre>
  <p>I'm interested in some general advise around best practices how to save non-ASCII dicts in Datastore using Python 2 and ndb.</p>
  <p>I am thinking about trying pickle/cPickle, but am a bit reluctant because here we store user provided data, so using pickle might not be very secure.</p>