After some thoughts I came to the following conclusion: if you guys 
want to keep support of legacy charsets in fact you don't have to 
force model objects too be unicoded. Firstly, they are passed to 
templates and filters and we can't mix legacy charsets with unicode in 
one template. Next, if I don't use unicode, I don't have to code my 
python sources (views) in unicode. So, I need to be able to pass 
string values into my model objects and my strings are not unicoded.

So if everyone agreed, the way is simple:
1. when django loads data from db and fills in a model object, all 
strings have to be encoded according to DEFAULT_CHARSET
2. when django passes data from form object to model object, it has to 
encode strings according to DEFAULT_CHARSET again

In fact, my patch #3370 is wrong then, actually newforms.model.save() 
method should be patched to recode clean_data from unicode to 
DEFAULT_CHARSET (if it differs) when passing this data to model object 
and for now we would get everything in place: utf8-based templates and 
legacy-charset-based templates would be both correctly supported and 
any national characters would be stored in db perfectly as they do now 
with oldforms (ofcourse remember what I said about #952)
And the second required patch is about recoding unicode strings loaded 
from db to DEFAULT_CHARSET (if differs) when passing them to model 
objects and back from DEFAULT_CHARSET to unicode when we save model 
objects to db. This patch will solve #952 issue and again it will work 
ok with both unicode and legacy-charset based templates.
And even more here: if we have a legacy database which doesn't 
understand unicode, we can realize this fact immediately after 
connecting to db and decide the correct way to decode/encode strings.

As I see, this way fixes all unicode/charsets issues and answers all 
questions. So, if there are no objections, I can write this patch 
tomorrow or by monday.


--~--~---------~--~----~------------~-------~--~----~
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