title: Why doesn't this conversion to utf8 work?
body: <p>I have a subprocess command that outputs some characters such as '\xf1'. I'm trying to decode it as utf8 but I get an error.</p>
  
  <pre><code>s = '\xf1'
  s.decode('utf-8')
  </code></pre>
  
  <p>The above throws:</p>
  
  <pre><code>UnicodeDecodeError: 'utf8' codec can't decode byte 0xf1 in position 0: unexpected end of data
  </code></pre>
  
  <p>It works when I use 'latin-1' but shouldn't utf8 work as well? My understanding is that latin1 is a subset of utf8.</p>
  
  <p>Am I missing something here?</p>
  
  <p>EDIT:</p>
  
  <pre><code>print s # ñ
  repr(s) # returns "'\\xa9'"
  </code></pre>