#5778: Email subjects not encoded properly
------------------------------------------------------------+---------------
   Reporter:  Thomas Petazzoni <[EMAIL PROTECTED]>  |                Owner:  
nobody        
     Status:  new                                           |            
Component:  Core framework
    Version:  SVN                                           |           
Resolution:                
   Keywords:                                                |                
Stage:  Accepted      
  Has_patch:  0                                             |           
Needs_docs:  0             
Needs_tests:  0                                             |   
Needs_better_patch:  0             
------------------------------------------------------------+---------------
Comment (by tpetazzoni):

 From a raw Python shell, with PYTHONPATH=/path/to/django:

 {{{
 [EMAIL PROTECTED]:/srv/www/trivialibre.humanoidz.org$ python
 Python 2.4.4 (#2, Apr  5 2007, 20:11:18)
 [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import sys
 >>> print sys.getdefaultencoding()
 ascii
 >>> from django.utils.encoding import force_unicode
 >>> str(force_unicode('\xc3\x85ngstr\xc3\xb6m'))
 Traceback (most recent call last):
   File "<stdin>", line 1, in ?
 UnicodeEncodeError: 'ascii' codec can't encode character u'\xc5' in
 position 0: ordinal not in range(128)
 >>> str(force_unicode('Nouvelle question "Et ça marche bien é ?"'))
 Traceback (most recent call last):
   File "<stdin>", line 1, in ?
 UnicodeEncodeError: 'ascii' codec can't encode character u'\xe7' in
 position 22: ordinal not in range(128)
 }}}

 So here, it works properly. Now, from a Python shell ran using "manage.py
 shell", still with PYTHONPATH=/path/to/django/:

 {{{
 [EMAIL PROTECTED]:/srv/www/trivialibre.humanoidz.org$
 ./trivialibre/tvl/manage.py shell
 Python 2.4.4 (#2, Apr  5 2007, 20:11:18)
 [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 (InteractiveConsole)
 >>> import sys
 >>> print sys.getdefaultencoding()
 utf-8
 >>> from django.utils.encoding import force_unicode
 >>> str(force_unicode('\xc3\x85ngstr\xc3\xb6m'))
 '\xc3\x85ngstr\xc3\xb6m'
 >>> str(force_unicode('Nouvelle question "Et ça marche bien é ?"'))
 'Nouvelle question "Et \xc3\xa7a marche bien \xc3\xa9 ?"'
 >>>
 }}}

 The second string tested above is the one I was using for my tests. But
 yours also perfectly shows the problem.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/5778#comment:4>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to