Unicode, Python and win console
I wrote small python script that had to print out text in French. French language contains different umlauts. As I used UTF-8 for my code source, I assumed that python is able to print texts in correct encodings. It doesn’t. Solution is to specify source code encoding and specify special characters as ‘\xNN’:
#!/usr/bin/python # -*- coding: UTF-8 -*- for i in range(0, 255): print hex(i), ": ", chr(i) print "Edge of ice in Estonian is: j\x84\x84\x84\x84r"
Tested with python2.4 and WinXP