Hello All,

It seems I'm facing the same problem or an equivalent problem.
I'll try to use newforms , running python 2.4.3

>>> from django.newforms import *
>>> from listing.models import Industry
>>> w = SelectMultiple()
>>> print w.render('xxx',None,((industrie.id,industrie.fr) for industrie in 
>>> Industry.objects.all()))
Traceback (most recent call last):
  File "<console>", line 1, in ?
  File "/usr/lib64/python2.4/site-packages/django/newforms/
widgets.py", line 193, in render
    output = [u'<select multiple="multiple"%s>' %
flatatt(final_attrs)]
  File "/usr/lib64/python2.4/site-packages/django/newforms/util.py",
line 6, in <lambda>
    flatatt = lambda attrs: u''.join([u' %s="%s"' % (k, escape(v)) for
k, v in attrs.items()])
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
42: ordinal not in range(128)

Here is the used tulpe :
>>> [(industrie.id,industrie.fr) for industrie in Industry.objects.all()]
[(1L, 'Administration / Organisation / Services G\xc3\xa9n
\xc3\xa9raux'), (2L, 'A\xc3\xa9ronautique'), (3L, 'Agriculture /
Agro'), (4L, 'Art / Culture / Mode'), (5L, 'Artisanat'), (6L,
'Automobile'), (7L, 'Banque / Bourse / Assurance'), (8L, 'Biologie /
Physique / Chimie'), (9L, 'BTP'), (10L, 'Commerce / Marketing'), (11L,
'Communication / M\xc3\xa9dia'), (12L, 'Conseil / Audit / Juridique'),
(13L, 'Direction'), (14L, 'Documentation / Traduction'), (15L,
'Droit / Fisca / Eco'), (16L, 'Electronique / M\xc3\xa9canique'),
(17L, 'Enseignement et Formation'), (18L, 'Environnement'), (19L, 'Gde
consommation / Distribution / Luxe'), (20L, 'Gde Ecoles / Universit
\xc3\xa9s'), (21L, 'Gestion / Finance / Audit / Compta.'), (22L,
'Immobilier'), (23L, 'Imprimerie / Presse / Editions'), (24L,
'Industrie / Production / Qualit\xc3\xa9 / Maintenance'), (25L,
'Informatique / T\xc3\xa9l\xc3\xa9com'), (26L, 'Multim\xc3\xa9dia /
Internet / Nouvelle \xc3\xa9conomie'), (27L, 'Recherche et D
\xc3\xa9veloppement'), (28L, 'Ressources Humaines'), (29L, 'Sant
\xc3\xa9 / Pharmacie'), (30L, 'Service public / Association'), (31L,
'Tourisme / H\xc3\xb4tellerie / Restauration / Loisirs'), (32L,
'Transports / Logistique'), (33L, 'Vente / Distribution'), (34L,
'Gestion de projet'), (35L, 'Sport'), (36L, 'S\xc3\xa9curit\xc3\xa9')]

if I select english (no accentued language) it's ok :

>>> from django.newforms import *
>>> from listing.models import Industry
>>> w = SelectMultiple()
>>> print w.render('xxx',None,((industrie.id,industrie.en) for industrie in 
>>> Industry.objects.all()))
<select multiple="multiple" 1="Administrative / Support Services"
2="Aeronautic" 3="Agriculture" 4="Arts / Culture / Fashion" 5="Craft
industry" 6="Car industry" 7="Finance / Economics / Insurance"
8="Biotechnology / Pharmaceutical / Science" 9="Construction"
10="Sales / Marketing" 11="Advertising / Public Relations"
12="Consulting / Auditing / Legal" 13="Management" 14="Documentation /
Translation" 15="Low / Financial Services" 16="Electronics /
Mechanics" 17="Teaching and Training" 18="Environment" 19="Food /
Luxury Industry" 20="University" 21="Finance / Accouting / Auditing"
22="Real estate" 23="Printing works / Press / Publishing"
24="Industry / Production / Quality / Maintenance" 25="IT / Computer /
Telecomunication" 26="Multimedia / Internet / E-Commerce" 27="Research
and Development" 28="Human ressources" 29="Healthcare /
Pharmaceutical" 30="Public utilities / Association" 31="Tourism /
Hotel / Restaurant / Recreation" 32="Transportation  / Wharehousing"
33="Retail / Wholesale" 34="Project Management" 35="Sport"
36="Security" name="xxx">
</select>

I couldn't find a solution to deal with french accentued language in
newforms.

Xav

>   UnicodeEncodeError at /create/
>   'ascii' codec can't encode character u'\xe4' in position 31: ordinal
> not in range(128)


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