I saved my script in UTF-8 encoding.
I changed my codepage on windows to 65001.
I'm on python 2.6
Script #1
# -*- coding: utf-8 -*-
print u'Español'
x = raw_input()
Script #2
# -*- coding: utf-8 -*-
a = 'Español'
a.encode('utf8')
print a
x = raw_input()
Script #1, prints the word fine with no errors, Script #2 does error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf1 in position 4: ordinal not in range(128)
I want to be able to print this variable without errors dynamically as in script #2. the encode('utf8') was mentioned to me as the equivalent of doing u'string'
Obviously, it's not because it throws errors. How can I do it folks?