[Zope] Unicode Error
Tino Wildenhain
tino@wildenhain.de
Mon, 04 Nov 2002 00:08:13 +0100
Hi,
--On Samstag, 2. November 2002 20:15 +0000 Toby Dickenson
<tdickenson@geminidataloggers.com> wrote:
> On Saturday 02 November 2002 1:48 am, Tino Wildenhain wrote:
>
>> if encoding != "ascii":
>> sys.setdefaultencoding(encoding)
>>
>> This implies modification of the installed code to change
>> default behavior. I would consider this as bad.
>> Why isnt a locales sensitive version the default?
>
> That would make it difficult to write reliable portable Python code. It
> is a good thing that Python has predictable behaviour for things like
> (string+integer), a local-sensitive or user-sensitive default encoding
> would make (plain string+unicode string) unpredictable.
*think* *think* *think*
Sorry, I cannot see how this would be unpredictable.
Ascii-users will use only thier ascii charset information and -
with or without locales - get their ascii unicode strings concenated. Fine.
international users who whould have no locales - this would bring them the
same error
they are getting now -> default would be ascii
international users with locales setting would assume they can use every
allowed character in their encoding - because of locales sensitiveness
it would happen to work as expected. In every module.
If some modules has seriously requirements to depend on a specific encoding
it should explicitely use encode('ascii') on it.
I'm open to comments on what I might have overlooked.
Regards
Tino