Converting datetime.ctime() values to Unicode

P

python

I would like to convert datetime.ctime() values to Unicode.

Using Python 2.6.4 running under Windows I can set my locale to
Spanish like below:

Then I can pass %a, %A, %b, and %B to ctime() to get day and
month names and abbreviations.
's\xe1bado'

How do I convert the 's\xe1bado' value to Unicode? Specifically what
encoding do I use?

I'm thinking I might do something like the following, but I'm not sure
this is the right approach.
codePage = locale.getdefaultlocale()[ 1 ]
dayNameUnicode = unicode( dayName, codePage )
dayNameUnicode
u's\xe1bado'

Feedback appreciated.

Regards,
Malcolm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top