On Sun, 2008-03-09 at 18:51 -0700, Jean-Pascal Houde wrote:
> Excuse me for the delay... I finally had some time to debug this
> issue.
> First, about the problems I was having :
> I moved my application on another server, using apache+mod_python
> instead of lighttpd+fastcgi, and all my unicode problems disappeared.
> 
> But I made some more tests using a blank project, with a simple test
> app, and I was able to reproduce the problem. Here what I found (sorry
> for the long message)...
> 
> My test project/app is pretty standard, I've only modified DB settings
> (mysql 4.1.20 database), and added a simple entry in urls.py.
> Here are the models.py and views.py files :

This is very unlikely to be a bug in Django, since this area has been
tested quite thoroughly. In fact, if you peruse the test suite, you'll
notice that we test precisely the situation you are attempting. So
there's something about your setup.

Firstly, verify that your database table(s) are expecting data encoded
in something that can handle Unicode data. Basically, this means, ensure
they are not set up to store things with a latin1 encoding. In the my
original reply in this thread, I pointed out that it looked like a
database character set issue, since you're trying to store non-ASCII
data and were forcing the setting to "latin1". Please verify that you've
corrected that and the database tables are set up to store the data
properly. Ideally, the table encoding should be "utf8". That is
simplest.

[...]
> views.py :
> from django.http import HttpResponse, HttpResponseRedirect, Http404
> from django.shortcuts import render_to_response
> from testproject.testapp.models import TestModel

There should be a line at the top of views.py that says

        # coding: utf-8
        
(or similar) to tell Python how to handle the non-ASCII data you include
later.

[...]
> Now here is the stack trace, after modifying django's
> urlresolvers.py :
> Unicode error hint
> 
> The string that could not be encoded/decoded was: �v�neme

This isn't really trapping the problem at the point it occurs. I would
have preferred that you tried to get it closer to where the exception
was raised. In any case, using print to display this information is
never useful in situations like this, because, as you see, it tries to
interpret the bytes and turn them into characters. What are the actual
character codes involved? In other, words, what is repr(...) of this
data?

It feels to me like every time you post in this thread you've tried
something else without addressing any of the issues raised in my
previous replies. If that's the way you want to work, fine. I hope
somebody else can help you. It doesn't seem to be an effective use of my
time, however. Perhaps you could go back through the thread and make
sure you've carefully accounted for all the items I've addressed and
ruled them out.

Malcolm

-- 
Depression is merely anger without enthusiasm. 
http://www.pointy-stick.com/blog/


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