Converting datetime.ctime() values to Unicode

Jerry Hill malaclypse2 at gmail.com
Mon May 17 14:32:59 EDT 2010


On Mon, May 17, 2010 at 2:14 PM,  <python at bdurham.com> wrote:
> In researching a solution, I believe locale.getpreferredencoding() might
> be a better choice (than locale.getdefaultlocale()[ 1 ]) for determining
> a system's default encoding?

I haven't used the locale module a lot, but it seems to me that if
you're setting the locale with locale.setlocale(), you should get the
encoding from locale.getlocale()[1].

You're not really interested in the system's default encoding at this
point, you're interested in the encoding of the locale you've
explicitly set.

-- 
Jerry



More information about the Python-list mailing list