Hi,

I'm getting a random, wierd UnicodeDecodeError when calling 
request.get_full_path() in one of my views. This specific view displays some 
search reaults, and the error always occurs when a user selects the second 
results page (results are paginated).

The query string is UTF-8 encoded, and is of the form (for the second page) 
'p=2&q=\xd7\xa2\xd7\xa7\xd7\x9c'. This query string, for example, is a valid 
Hebrew utf-8 word.

The error occurs only on a production server, I never saw it in a local 
runserver. The production server is run through mod_wsgi daemon. The exact 
error is:

 File "/home/arsys/lib/python2.5/django/core/handlers/wsgi.py", line 105, in 
get_full_path        return '%s%s' % (self.path, 
self.environ.get('QUERY_STRING', '') and ('?' + self.environ.get('QUE
RY_STRING', '')) or '')                                                         
                
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in position 7: 
ordinal not in range(128)  


What's wierd here, is that django is trying to decode the string assuming it is 
ascii, where it should use utf-8 which is the default. Also, as I said, this 
occurs quiet rarely, and most of the time, with the very same query string, it 
works fine.

This site is in beta stage, and I don't have too many visitors. I noticed that 
it happens probably with the same client, with a browser identified as:
'HTTP_USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'

Other that that, I'm completely in the dark. Could it be that a browser causes 
the server to use a different (than its default) encoding? Any other ideas?

Thanks,

Amit

P.s. Also, as for the code in wsgi.py, shouldn't the format string above be 
preceded by 'u'? I.e., shouldn't it read u'%s%s'?



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