Python unicode displayed in editor and stored in memory
<p>I am python new learner.<br/>
Here is a question confused me. <br/>
My intention is to store a Chinese character in a variable.<br/>
I tried two different ways:<br/>
Method 1:<br/></p>

<pre><code>&gt;&gt;&gt; x = u'\u6ce8'
&gt;&gt;&gt; print x
注
</code></pre>

<p>Method 2:<br/></p>

<pre><code>&gt;&gt;&gt; y = u'注'
&gt;&gt;&gt; y
u'\xd7\xa2'
&gt;&gt;&gt; print y
×¢
</code></pre>

<p>If i use method 2, in the python interpreter or a text editor, the character is displayed as I typed in.<br/></p>

<p>But actually in the memory, this unicode character is converted into two bytes.
And the byte value is different from the real value for that character (in method 1)<br/></p>

<p>Question:<br/></p>

<ol>
<li>In method 2, who does this conversion from the chinese character I typed in to those two bytes? OS, python interpreter?</li>
<li>Why the conversion seems wrong? (should be 6ce8 not d7a2)</li>
<li>Why if I save the script to a .py file and open it again, I can
see the correct character as I typed in?</li>
<li>What is your solution for method 2 that I can print the right character?
<br/>
Thanks in advance!</li>
</ol>