Why does unicode-escape decode escape symbols that are already escaped?

2015-05-10 Thread Somelauw .
In Python 3, decoding "€" with unicode-escape returns 'â\x82¬' which in my opinion doesn't make sense. The € already is decoded; if it were encoded it would look like this: '\u20ac'. So why is it doing this? In Python 2 the behaviour is similar, but slightly different. $ python3 -S Python 3.3.3 (

Re: Why does unicode-escape decode escape symbols that are already escaped?

2015-05-10 Thread Somelauw .
2015-05-10 20:39 GMT+02:00 Albert-Jan Roskam : > > Hi, > > I only have Python 2 on my phone, but I am suprised that you (and are able > to) decode unicode strings. What result do you get when you do the > following in Python 3: > > Python 2.7.2 (default, Oct 25 2014, 20:52:15) > [GCC 4.9 20140827

Re: Why does unicode-escape decode escape symbols that are already escaped?

2015-05-10 Thread Somelauw .
2015-05-10 18:06 GMT+02:00 Chris Angelico : > Whenever you start encoding and decoding, you need to know whether > you're working with bytes->text, text->bytes, or something else. In > the case of unicode-escape, it expects to encode text into bytes, as > you can see with your second example - you