[Tutor] How can I see properly my korean.

Young-gyu Park jackup at gmail.com
Thu May 31 16:15:06 CEST 2007


Yes, It works.

Thank you so much kent.

you make the time when I spent two days for solving this problem useless.

you are genious ^^

Why I didn't know that *"from django.utils.simplejson import dumps" !!!*

Do you have anything which you want to let me know, when I develop the ajax
application by Django?

Best regards.



On 5/31/07, Kent Johnson <kent37 at tds.net> wrote:
>
> Young-gyu Park wrote:
> >             fileHandle = open (
> >     '/var/chroot/www/htdocs/django/js/model.js', 'w' )
> >             fileHandle.write( codecs.BOM_UTF8 )
> >             print >> fileHandle, 'var blog = '
> >             print >> fileHandle, blog
> >             fileHandle.close()
> >
> > This is the part of my whole source code.
>
> OK, blog is a dict containing nested dicts. The problem is that printing
> a dict prints the repr() of the contents of the dict, which gives you
> the \x escapes for your strings.
> >
> > I try to convert the python dict into javascript array.
>
> Since you are clearly using Django, I suggest you use the simplejson
> module to do the serialization as I showed in my previous email. Instead
> of
> print >> fileHandle, blog
> try
> print >> fileHandle, dumps(blog, ensure_ascii=False)
>
> where dumps is imported from django.utils.simplejson
>
> Kent
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070531/a550fc2e/attachment.htm 


More information about the Tutor mailing list