Unicode issue, correctly decoding/encoding string in python?

I do not know how and where you get this message, but look at this exmple.

I do not know how and where you get this message, but look at this exmple: $ python Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) GCC 4.2.1 (Apple Inc. Build 5646) on darwin Type "help", "copyright", "credits" or "license" for more information. >>> txt = u'Dassault Myst\xe8re' >>> txt u'Dassault Myst\xe8re' >>> print txt Traceback (most recent call last): File "", line 1, in UnicodeEncodeError: 'ascii' codec can't encode character u'\xe8' in position 13: ordinal not in range(128) >>> ^D $ export LANG=en_US.

UTF-8 $ python Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) GCC 4.2.1 (Apple Inc. Build 5646) on darwin Type "help", "copyright", "credits" or "license" for more information. >>> txt = u'Dassault Myst\xe8re' >>> txt u'Dassault Myst\xe8re' >>> print txt Dassault Mystère >>>^D So as you can see if you have a console as ASCII then during print, there is a conversion from unicode to ascii, and if there is character outside ASCII scope - exception is thrown.

But if console can accept unicode, then everything is correctly displayed.

Well, that fixed the printing to console issue. But I still have a problem when building a url, because when I append - u'Dassault Myst\xe8re' to url urllib2 chokes on it when making a http request. I guess it's expecting an ascii string, and I'm sending something else?

– Maverick Mar 12 at 22:44 My url looks like this: u'youtube. Com/results? Search_query=Dassault+Myst\xe8re&aq=0' and urllib2 doesn't like that it seems.

– Maverick Mar 12 at 22:47 2nd part solved using this answer: stackoverflow. Com/questions/4389572/… – Maverick Mar 12 at 22:55.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions