<div>&nbsp;</div>
<div>Yes, It works.</div>
<div>&nbsp;</div>
<div>Thank you so much kent.</div>
<div>&nbsp;</div>
<div>you make the time when I spent two days for solving this problem useless.</div>
<div>&nbsp;</div>
<div>you are genious ^^</div>
<div>&nbsp;</div>
<div>Why I didn&#39;t know that <strong>&quot;from django.utils.simplejson import dumps&quot; !!!</strong></div>
<div>&nbsp;</div>
<div>Do you have anything which you want to let me know, when I develop the ajax application by Django?</div>
<div>&nbsp;</div>
<div>Best regards.</div>
<div><br><br>&nbsp;</div>
<div><span class="gmail_quote">On 5/31/07, <b class="gmail_sendername">Kent Johnson</b> &lt;<a href="mailto:kent37@tds.net">kent37@tds.net</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Young-gyu Park wrote:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fileHandle = open (<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; &#39;/var/chroot/www/htdocs/django/js/model.js&#39;, &#39;w&#39; )
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fileHandle.write( codecs.BOM_UTF8 )<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print &gt;&gt; fileHandle, &#39;var blog = &#39;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print &gt;&gt; fileHandle, blog<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fileHandle.close()<br>&gt;
<br>&gt; This is the part of my whole source code.<br><br>OK, blog is a dict containing nested dicts. The problem is that printing<br>a dict prints the repr() of the contents of the dict, which gives you<br>the \x escapes for your strings.
<br>&gt;<br>&gt; I try to convert the python dict into javascript array.<br><br>Since you are clearly using Django, I suggest you use the simplejson<br>module to do the serialization as I showed in my previous email. Instead of
<br>print &gt;&gt; fileHandle, blog<br>try<br>print &gt;&gt; fileHandle, dumps(blog, ensure_ascii=False)<br><br>where dumps is imported from django.utils.simplejson<br><br>Kent<br></blockquote></div><br>