[Zope3-dev] test errors due to ascii defaultencoding assumption

Tim Peters tim.peters at gmail.com
Thu Oct 20 14:11:35 EDT 2005


[Stefan Rank]
> Thanks for the clarification, sounds very reasonable.
> I'm now trying to think of my incentive for changing it in the first
> place, and my notes say that it was necessary to get some file
> operations to behave.
> Unfortunately I did not note which ones they were, but I think it was
> something like shutil.copytree() on Windows failing.
>
> The problem was that it *internally* did not deal correctly with unicode
> filenames, i.e. there was no way to influence it from the calling side.
> Then I found site.py, enabled the platform dependent default encoding,
> and did not give it another thought...
>
> (I think at that time it was py2.3, but if come across a repeatable test
> case I'll post a bug report.)

That's the right thing to do.  While I run on Windows, my filenames
are all 7-bit ASCII, so I'll never bump into it.

[Tim Peters]
>> I'm sure sys.setdefaultencoding will vanish in a future Python
>> release, since it wasn't intended to persist beyond initial
>> development to begin with.

[Stefan]
> In that case may I suggest changing the default to utf-8.
> ( I think it's about time this ascii thing died ;-)

You may, but suggesting a Python change on a Zope list is like
suggesting a Zope change on a Python list ;-)  The long-term plan for
Python is that Unicode will become the only string type, at which
point the concept of a "default" encoding will become meaningless
(there won't be any "8-bit strings" then).  Until then, since the
default encoding has been "ascii" since it was introduced, I expect
that an attempt to change the years-old default now would face strong
opposition.


More information about the Zope3-dev mailing list