1

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!

1
  • 2
    You 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). Commented Mar 28, 2012 at 21:30

1 Answer 1

5

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.