I'm trying to do this in Python: 'Fi\xc3\xb1a'.decode('utf-8')
I expect the result to be Fiña. But the result is actually: u'Fi\xf1a'
No idea what is going on, some help on this would be much appreciated.
Thanks!
Chris Morgan
91.6k28 gold badges217 silver badges220 bronze badges
asked Mar 28, 2012 at 21:24
Ringo Blancke
2,4446 gold badges30 silver badges54 bronze badges
-
2You shouldn't call it an "error" if you don't fully understand it. Chances are you are just misinterpreting the situation (like it is the case here).Niklas B.– Niklas B.2012年03月28日 21:30:45 +00:00Commented Mar 28, 2012 at 21:30
1 Answer 1
You're getting the correct result, the Unicode codepoint for ñ is U+00f1. It's just that Python won't display the Unicode character directly. Try it in a print statement and see what you get.
answered Mar 28, 2012 at 21:27
Mark Ransom
310k45 gold badges423 silver badges660 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-py