Nick Coghlan wrote: > M.-A. Lemburg wrote: >> "Martin v. Löwis" wrote: >>> Hmm - what do you mean by "normally"? Normally, text files are meant >>> for human readers, not for exchange between programs. >> >> It's rather common to exchange text files between users... and >> in form of XML and CSV files, these also tend to get used as >> input for programs every now and then ;-) > >>From a non-Unicode-maven point of view, this seems like a case where > practicality beats purity. The pure solution would be to refuse to guess > and force application developers to deal with this (in full knowledge > that they usually won't, since too many applications are still written > by English speakers that assume everyone uses ASCII or latin-1). The > practical solution is to guess an encoding that should work for files > that are restricted to a single machine, or a network of machines > configured to all use the same default text file encoding. > > At least the latter approach only runs into trouble when there is a > genuine encoding mismatch problem. A Python that refused to guess a > plausible default encoding for text files would cause problems *all* the > time. Use the encoding recommended by the locale eliminates a lot of > false alarms at the potential cost of making the true faults more > difficult to analyse when they do arise. That sounds like a reasonable > trade-off from where I'm standing.
Simply ignoring the problems is not going to educate developers and since the world is moving towards Unicode and Python 3.x uses Unicode throughout, punting on such problems is a poor way to move forward, at least IMHO. What's worse: it makes running Python applications unpredictable, since it's likely that some user is going to run the application using a different locale setting than you've used in your test cases. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jan 23 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