[Python-Dev] unifying str and unicode

Antoine Pitrou solipsis at pitrou.net
Mon Oct 3 21:37:22 CEST 2005


Hi,

Le lundi 03 octobre 2005 à 20:37 +0200, Fredrik Lundh a écrit :
> > If I have an unicode string containing legal characters greater than
> > 0x7F, and I pass it to a function which converts it to str, the
> > conversion fails.
> 
> so?  if it does that, it's not unicode safe.  
[...]
> what's that has to do with
> my argument (which is that you can safely mix ascii strings and unicode
> strings, because that's how things were designed).

If that's how things were designed, then Python's entire standard
library (not to mention third-party libraries) is not "unicode safe" -
to quote your own words - since many functions may return 8-bit strings
containing non-ascii characters.

There lies the problem for many people, until the stdlib is fixed - or
until the string types are changed. That's why you very regularly see
people complaining about how conversions sometimes break their code in
various ways.

Anyway, I don't think we will reach an agreement here. We have different
expectations w.r.t. to how the programming language may/should handle
general text. I propose we end the discussion.

Regards

Antoine.




More information about the Python-Dev mailing list