Michael Foord wrote:
> On 20/01/2010 21:37, M.-A. Lemburg wrote:
>> The only supported default encodings in Python are:
>>
>>   Python 2.x: ASCII
>>   Python 3.x: UTF-8
>>    
> 
> Is this true? I thought the default encoding in Python 3 was platform
> specific (i.e. cp1252 on Windows). That means files written using the
> default encoding on one platform may not be read correctly on another
> platform. Slightly off topic for this discussion I realise.

Yes, the above is what Python implements.

However, the default encoding is only used internally when converting
8-bit strings to Unicode.

When it comes to I/O there are several other encodings which can get
used, e.g. stdin/out/err streams each have their own encoding
(just like arbitrary file objects), OS APIs use their own encoding,
etc.

If no encoding is given for these, Python will try to find a
reasonable default. Python 2.x and 3.x differ a lot in how this
is done.

As always: It's better not to rely on such defaults and explicitly
provide the encoding as parameter where possible.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jan 21 2010)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to