Windows XP unicode and escape sequences

jyoung79 at kc.rr.com jyoung79 at kc.rr.com
Wed Dec 12 16:51:10 EST 2007


I mainly work on OS X, but thought I'd experiment with some Python code on XP.  The 
problem is I can't seem to get these things to work at all.

First of all, I'd like to use Greek letters in the command prompt window, so I was going to
use unicode to do this.  But in the command prompt, the unicode characters are displaying
as strange looking characters.  I tried installing the 'Bitstream Vera Sans Mono' font in hopes
it had all the characters I needed but this didn't seem to work either.  Is the problem the font?  
And if so, is there a certain font that has unicode '03B1', etc?  Here's some code I tried:

v = u'\u03B1\u03B2\u03B3'.encode('utf-8')
print v #just displays squares

The next problem I'm having is I can't seem to color the text with ansi escape sequences.  I
added "device=%SystemRoot%\system32\ansi.sys" to the bottom of the CONFIG.NT file, and experimented with code like this:

print chr(27) + "[36mTest" + chr(27) + "[0m"

>From what I found on-line, ascii character 27 seems to be the escape key I need, but I can't
seem to get it to work.  It just displays an arrow.

If anyone has any thoughts, I'd love to hear them.

Thanks!

Jay



More information about the Python-list mailing list