On Mon, 2009-01-26 at 14:40 -0800, SanPy wrote: > For my website, I need to write this in one of my generated html's > (dynamically, of course): > > <script type="text/javascript"> > var prices=[[0, '\u20ac 0'],[100, '\u20ac 100'],[150, '\u20ac 150'], > [200, '\u20ac 200'],[250, '\u20ac 250'],[300, '\u20ac 300']]; > </script> > > BTW, \u20ac represents the € symbol. > > Whatever I try, I can't write '\u20ac 0' dynamically. It shows up like > u'\u20ac 0' or '\\u20ac 0', but never the required '\u20ac 0'. Can > somebody please help me with this?
How are you trying to do this? Do the values come from a string that you're substituting into a template? If that's the case, have you looked at the "escapejs" filter ([1])? That will allow you to use the € character in your raw data and the template rendering will take care of suitably encoding it for Javascript purposes. [1] http://docs.djangoproject.com/en/dev/ref/templates/builtins/#escapejs Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" 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-users?hl=en -~----------~----~----~----~------~----~------~--~---

