By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,199 Members | 1,077 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,199 IT Pros & Developers. It's quick & easy.

Does unicode() equal to unicode(sys.getfilesystemencoding()) ?

P: n/a
The follow statement comes from the Python 2.5 documentation
--------------
encode( [encoding[,errors]])

Return an encoded version of the string. Default encoding is the
current default string encoding. errors may be given to set a
different error handling scheme.
---------------
what's the "Default encoding" mean ? Does it equal to the
sys.getfilesystemencoding()?
If yes, but :
>>>unicode('*国', sys.getfilesystemencoding())
u'\u4e2d\u56fd'
>>>unicode('*国')
Traceback (most recent call last):
File "<input>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd6 in position
0: ordinal not in range(128)

It seems the "Default encoding" is not equal to the
sys.getfilesystemencoding(). And then, what is it ?

Jun 6 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
人言落日是天涯,望极天涯不见家 wrote:
The follow statement comes from the Python 2.5 documentation
--------------
encode( [encoding[,errors]])

Return an encoded version of the string. Default encoding is the
current default string encoding. errors may be given to set a
different error handling scheme.
---------------
what's the "Default encoding" mean ? Does it equal to the
sys.getfilesystemencoding()?
If yes, but :
>>>>unicode('*国', sys.getfilesystemencoding())
u'\u4e2d\u56fd'
>>>>unicode('*国')
Traceback (most recent call last):
File "<input>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd6 in position
0: ordinal not in range(128)

It seems the "Default encoding" is not equal to the
sys.getfilesystemencoding(). And then, what is it ?
It is sys.getdefaultencoding(). On a properly configured system this is
always 'ascii'.

Peter
Jun 6 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.