Re: Unable to run print('Réussi') on windows and on linux

wxjmfauth at gmail.com wxjmfauth at gmail.com
Fri Aug 15 04:23:05 EDT 2014


Le jeudi 14 août 2014 14:35:51 UTC+2, marc.van... at gmail.com a écrit :
> Hello,
> 
> 
> 
> This very simple program runs well on windows 7
> 
> 
> 
> # -*- utf8 -*-
> 
> print('Réussi')
> 
> 
> 
> But, when I start the vrey same file on Linux (ubuntu 14), I got:
> 
> 
> 
> Traceback (most recent call last):
> 
>   File "/partages/bureau/PB/Dev/Python3/test.py", line 2, in <module>
> 
>     print('R\xe9ussi')
> 
> UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 1: ordinal not in range(128)
> 
> 
> 
> What should i do to let the same program run on both OS, without changes?
> 
> 
> 
> Thank you for your answer
> 

My guess.
Your created "utf-8" file may contain a "mark", wrongly called BOM,
and your *x toll is not handling it.

jmf



More information about the Python-list mailing list