guitarift wrote:
> Unfortunately I can't control the charset this email uses...or can I?
What's important is that you're using a consistant character set in
your Python code. If you want to use Shift JIS encoded string
literals (constants) in your code you'll need to make sure that your
editor is set to use Shift JIS, that the Python interpreter knows that
they're Shift JIS strings and that your using the Shift JIS codec to
decode and encode the strings into and from Unicode as necessary. To
tell Python that you're using Shift JIS put the following line at the
start of *all* your Python files:
# coding: shift_jis
(If you're using GNU Emacs or VIM, there are alternative versions of
the above line that you can use instead that will also tell your
editor that you're using Shift JIS)
> Should I be using Python's standard library to encode/decode strings
> even if I am working with datastore entities?
It would probably be better as you would using a consistant method to
convert your strings through out your code. You'll need to decode any
Shift JIS encoded strings into Python Unicode strings before assigning
them to text datastore properties.
I don't read Japanese but that page has "coding: utf-8" on it which if
you're using tells the Python interpretter that your source code is
encoded with UTF-8 rather than Shift JIS.
Ross Ridge