tickets: 10449
This data as json
id | created | changetime | last_pulled_from_trac | stage | status | component | type | severity | version | resolution | summary | description | owner | reporter | keywords | easy | has_patch | needs_better_patch | needs_tests | needs_docs | ui_ux |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10449 | 2009-03-09 15:44:36 | 2018-11-13 22:19:07 | 2022-03-06 03:47:18.535515 | Accepted | new | Internationalization | Bug | Normal | 1.0 | HTML accents not escaped out when using forms | When passing a translated string to a select box using a Forms Select widget, the output string still contains accent HTML entity codes. For example: "Problemas para el Inicio de Sesión o relacionados con la Cuenta My code is set up as follows: Models.py {{{ from django.utils import translation from django.utils.translation import ugettext_lazy as _ SUBJECT = ( (10, _('Log-in or Account related problems')), (20, _('General enquiry')), (30, _('Other feedback')), ) }}} This is then used in a form: {{{ class HelpFeedbackForm(forms.Form): #form for user to submit their feedback when not logged in subject = forms.CharField(widget=forms.Select(choices=SUBJECT)) }}} This is then presented in the template as: {{ form.subject }} which produces: "Problemas para el Inicio de Sesión o relacionados con la Cuenta" as mentioned above. The translations are returned from the django.po file, but all of the HTML entity codes are returned as is, in the Select box in the template. Also, use of the safe template filter tag does affect this and the string is still rendered with accents. | nobody | tipan | accents, newforms | 0 | 0 | 0 | 1 | 1 | 0 |