title: encode string in Python 3 without unicode \xc2 subsitution
body: <p>So I was writing some code for some communication with a piece of hardware vis pySerial and i was using python 2.7.7 and everything worked fine, i switched to python 3.4 cause i issues with getting a GUI "framework" installed.</p>
  
  <p>So the problem i have is that I have to encode and decode strings that i send to the COM port, i didn't need to on Python 2.7.7</p>
  
  <p>Here is the string, i understand that the hex value 81 is not ascii but i need to send the string the way it is sent in python 2.7.7.</p>
  
  <pre><code>str = '\x1B\x81'
  </code></pre>
  
  <p>When i print str I get this:</p>
  
  <pre><code>b'\x1b\xc2\x81'
  </code></pre>
  
  <p>I assume that the \xc2 is some special unicode character for my \x81, I understand that \x is the escape character for hex and I'm not too sure how Python 2.7.7 writes the string to the serial port.</p>
  
  <p>Would this line: </p>
  
  <pre><code>ser.write('\x1B\x81')
  </code></pre>
  
  <p>send binary to the serial port? sorta like this:</p>
  
  <pre><code>ser.write('0001 1011 1000 0001')
  </code></pre>
  
  <p>Also if i send this:</p>
  
  <pre><code>ser.write('\x1B\x81')
  </code></pre>
  
  <p>to the hardware using Python 3, the hardware just hangs and does nothing, but in Python 2.7 it works.</p>