A dict in which the string values are unicode string like {'name': u'nav', 'school': u'mps'}
In javascript, i'm trying access that dict like
<script>
var poi = {{ dict }} ........... //Line #1
alert( poi.name )
</script>
while rending the html page line #1 is rendered as (error):
{'lastname': u'yadav', 'age': 23, 'id': 2, 'firstname': u'sahenky'}
One python solution is to encode the unicode string into some other format like ascii or utf-8(preferred)
str = u'nav'
str.encode('utf-8, 'ignore')
>>str
nav
Is there any elegant way to encode unicode string in python or javascript?