Foreign Character Problems In Python 2.5 and Tkinter

Juha S. jusa.sj at gmail.com
Sat Oct 13 11:22:10 EDT 2007


Thanks! Opening and saving the file with the iso-8859-1 codec seems to 
handle the characters correctly. Now the only problem left are the 
missing newlines in the output file. I tried googling for the iso code 
for newline and entering it in a Python string as '\x0A' but it doesn't 
work in the output file which still loses the newlines.


Janne Tuukkanen wrote:
> Sat, 13 Oct 2007 16:13:21 +0300, Juha S. kirjoitti:
>
>   
>> Thanks for the reply. I made changes to my code according to your 
>> example. Now any Scandinavian characters that are outputted by the 
>> program are missing in the Tk text box.
>>     
>
>
>   
>>             file = codecs.open(filename, 'r', 'utf-8', 'ignore')
>>     
>
>  Remove that 'ignore'. If you then get error which complains,
> that utf-8 codec can't handle the file, you've found the culprit.
> The file might be in iso-8859-1.
>
>
> 	JanneT
>
>   




More information about the Python-list mailing list