Unicode, command-line and idle

a.serrano at vielca.com a.serrano at vielca.com
Thu Apr 6 07:02:55 EDT 2006


Hello, the following program prompts the user for a word and tests to
see if it is the same as another one. If the user types "españa" (note
that the word contains an 'ñ'), the program should output "same". This
works if I run the code in IDLE but does not if I run it in the windows
console. Can someone explain me why this happens and how to get around
it?

# -*- coding: cp1252 -*-
text1 = 'españa'
text2 = raw_input()
if text1 == text2:
    print 'same'
else:
    print 'not same'




More information about the Python-list mailing list