Adrian Holovaty wrote:
> On 11/16/06, gabor <[EMAIL PROTECTED]> wrote:
>> - what is the plan, how should incoming data (GET or POST) handled?
>> some possibilities:
>> [...]
>> - we assume it's DEFAULT_CHARSET. we do not failover (means that if that
>> data is not in DEFAULT_CHARSET, the newforms code will (because of
>> "unicode(data,DEFAULT_CHARSET) raise the usual UnicodeDecodeError)
>> [...]
>> - we will make sure that we never raise such an error. that would mean,
>> that, for example:
>>         - we try DEFAULT_CHARSET
>>         - if we fail, we try <something_else_1> (probably utf-8)
>>         - if we fail, we try <something_else_2>
>>         - if we fail, we use ISO-8859-1 (which cannot fail)
> 
> I'd been assuming the first strategy -- no failover at all for data
> not in DEFAULT_CHARSET -- but I'm glad you brought this up, because
> that strategy is quite rigid and could cause hard-to-debug problems.
> Then again, the alternative (trying multiple charsets, one at a time)
> seems like overkill. What does everyone think?

btw. i'd prefer the first strategy.

i agree that it's rigid, but how would it cause "hard-to-debug" problems?

maybe i'm looking at the problem from a bit different point of view,

because i had this problem many times when trying to come up with a 
solution for unicode-django.

generally the question is this:

- the GET/POST-data comes in as byte-strings. how should we convert them 
to unicode strings?

imho the developers will simply have to learn that there is no easy 
solution when dealing with unicode, and if they send into the view data 
in the wrong encoding (read: not DEFAULT_CHARSET), then it will fail.

also, if we raise an exception, the developer will at least be informed, 
that the data he is sending in is wrong. if we will failover to 
ISO-8859-1, he might not find out about this problem for a long time.

btw. i am not sure when the unicode-conversion (and the raising of the 
exception) should happen...

at the beginning:

>form = ContactForm(request.POST)

or only when calling is_valid

>   if form.is_valid(): 


gabor

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to