<div dir="ltr">Just to note, PyDev does something behind the scenes (it sets the encoding for the console).<div><br></div><div>You may specify which encoding you want at your launch configuration (in the 'common' tab you can set the encoding you want for the shell).</div>

<div><br></div><div style>Cheers,</div><div style><br></div><div style>Fabio</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 12, 2013 at 3:12 PM, Magnus Pettersson <span dir="ltr"><<a href="mailto:magpettersson@gmail.com" target="_blank">magpettersson@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">> What encoding is this file?  Since you're appending to it, you really<br>
><br>
> need to match the pre-existing encoding, or the next program to deal<br>
><br>
> with it is in big trouble.  So using the io.open() without the encoding=<br>
><br>
> keyword is probably a mistake.<br>
<br>
</div>The .txt file is in UTF-8<br>
<br>
I have got it to work now in the terminal, but i dont understand what im doing and why i didnt need to do all the unicode strings and encode mumbo jumbo in eclipse<br>
<br>
#Here kanji = u"私"<br>
baseurl = u"<a href="http://www.romajidesu.com/kanji/" target="_blank">http://www.romajidesu.com/kanji/</a>"<br>
url = baseurl+kanji<br>
savefile([url]) #this test works now. uses: io.open(filepath, "a",encoding="UTF-8") as f:<br>
# This made the fetching of the website work. Why did i have to write url.encode("UTF-8") when url already is unicode? I feel i dont have a good understanding of this.<br>
page = urllib2.urlopen(url.encode("UTF-8"))<br>
<br>
<br>
....<br>
<span class="HOEnZb"><font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br></div>