Python encoding issue involving special characters -
i running win7 x64 , have python 2.7.5 x64 installed. using wing ide 101 4.1.
for reason, encoding messed up.
special_str = "sauté" print string # saut├⌐ string # 'saut\xc3\xa9'
i don't understand why when try print it, comes out weird. when write notepad text file, comes out right ("sauté"). problem when use beautifulsoup on string, comes out containing weird string "saut├⌐" , when output csv file, end html chunk containing weird bit. help!
you need declare encoding of source file python can decode string literals.
you can special comment @ top of file (first or second line).
# coding:<coding>
where <coding>
encoding used when saving file, example utf-8
.
Comments
Post a Comment