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

G

Guest

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 :
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 ?
 
P

Peter Otten

人言è½æ—¥æ˜¯å¤©æ¶¯ï¼Œæœ›æžå¤©æ¶¯ä¸è§å®¶ said:
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 :
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top