I am getting a UnicodeDecodeError when reading a file that has non-ascii characters. Here is the snippet of code
import codecs
import locale
print locale.getpreferredencoding()
fname = "c:\\testing\nonascii.txt"
f=codecs.open(fname,"r",encoding='utf-8')
sfile=f.read()
print type(file) #it's unicode
print sfile.encode('utf-8')
print type(sfile.encode('utf-8'))
nonascii.txt.