On 21/01/2010 21:21, "Martin v. Löwis" wrote:
Where the default *file system encoding* is used (i.e. text files are
written or read without specifying an encoding)
I think you misunderstand the notion of the *file system encoding*.
It is *not* a "file encoding", but the file *system* encoding, i.e.
the encoding for file *names*, not for file *content*.
It was used on Windows for Windows 95; it is not used anymore on Windows
(although it's still used on Unix).
Ok, I'm just using the wrong terminology. I'm aware that mbcs is used
for filename encoding on Windows (right?). The encoding I'm talking
about is the encoding that Python uses to decode a file (or encode a
string) when you do the following in Python 3:
text = open(filename).read()
open(filename, 'w').write(some_string)
It isn't the default encoding (always utf-8 by default in Python 3
apparently), it isn't the file system encoding which is the system
encoding used for file names. What is the correct terminology for this
platform dependent encoding that Python uses here?
The important point is that it is platform dependent - so if you ship
and use text files with your Python application and don't specify an
encoding then it will work fine on some platforms and blow up or use the
wrong encoding on other platforms.
I think there are way too many specific cases where Python 3 will encode
implicitly to get a complete list from the memory. If you really are
after a complete list, you'll need to perform a thorough code review.
For a few examples where some kind of default encoding is applied,
consider XML and the dbm interfaces.
Ok. Understood.
Thanks
Michael Foord
Regards,
Martin
--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog
READ CAREFULLY. By accepting and reading this email you agree, on behalf of
your employer, to release me from all obligations and waivers arising from any
and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap,
clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and
acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your
employer, its partners, licensors, agents and assigns, in perpetuity, without
prejudice to my ongoing rights and privileges. You further represent that you
have the authority to release me from any BOGUS AGREEMENTS on behalf of your
employer.
_______________________________________________
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