helping with unicode

self.python howmuchistoday at
Tue Jul 3 02:49:17 CEST 2012

it's a simple source view program.

the codec of the target website is utf-8
so I read it and print the decoded

import urllib2




It works fine on python shell

but when I make the file "" and run it,
Error rises.

Traceback (most recent call last):
  File "", line 8, in <module>
UnicodeEncodeError: 'cp949' codec can't encode character u'u1368' in position 5
5122: illegal multibyte sequence

cp949 is the basic codec of sys.stdout and cmd.exe  
but I have no idea why it doesn't works.
printing without decode('utf-8') works fine on IDLE but on cmd, it print broken characters(Ascii portion is still fine, problem is only about the Korean)

the question may look silly:(
but I want to know what is the problem or how to print the not broken strings.

thanks for reading.

More information about the Python-list mailing list