I tried all in this interesting thread Changing default encoding of Python? but nothing work for me. I use sublime text and when I try :
import sys
print(sys.stdout.encoding)
Output is : US-ASCII
I have a python script that works perfectly under Windows (Output is : utf-8)
But on osx 10.10.2, I always have a problem
Another thing that might help for answer, when I try in python shell (osX) this code :
>>> leString = '/Users/djex/Desktop/dosser\ é\ espace'
>>> type(leString)
<class 'str'>
>>> stringNew = leString.encode('utf-8')
>>> type(stringNew)
<class 'bytes'>
>>> print (stringNew)
b'/Users/djex/Desktop/dosser\\ \xc3\xa9\\ espace'
>>> print (stringNew.decode('utf-8'))
/Users/djex/Desktop/dosser\ é\ espace
>>>
All is ok.but...
when I try the same thing in sublime text (osX), it does not work
i always have this error
unicodeencodeerror 'ascii' codec can't encode character '\u0300' blabla
or error like
'str object has no attrbute decode'
I do not really understand where my problem comes
Ty for your help