Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Python Programming Language

Does unicode() equal to unicode(sys.getfilesystemencod ing()) ?


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

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc