2008/9/11 Jarek Zgoda <[EMAIL PROTECTED]>

>
> Coding cookie has nothing to do with bytestring literals decoding,
> it's only for unicode literals. If you try to coerce bytestring with
> unicode, decoding will be done using default system encoding, if
> encoding is not specified explicitly.
>

Indeed, that's why changing the python default encoding (no matter how
'dangerous' this is supposed to be) is the only technique that worked.

Please correct me if I am wrong then, but if the coding is supposed to be
specified explicitly, it seems like django is failing to do that in its
handling of __str__.  If my model is returning utf-8 data in its __unicode__
function, that shouldn't cause any problems.  That's the point of
__unicode__.


>
> Just do not use bytestrings to represent textual data. Soon (with
> Python 3) it will be considered bad habit.
>

This means changing every "string" into u"string", right?  This is where I
thought that the coding: cookie was supposed to fix things; you tell python
that your bytestring is in utf-8 so you don't have to label every single
string in your code individually.  Forcing each expression into a specific
type seems very un-pythonic.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to