title: Decoding escaped unicode in Python 3 from a non-ascii string
body: <p>I have been searching for hours now to find a way to fully reverse the result of a str.encode-call like this:</p>
  
  <pre><code>"testäch基er".encode("cp1252", "backslashreplace")
  </code></pre>
  
  <p>The result is</p>
  
  <pre><code>b'test\xe4ch\\u57faer'
  </code></pre>
  
  <p>now i want to convert it back with</p>
  
  <pre><code>b'test\xe4ch\\u57faer'.decode("cp1252")
  </code></pre>
  
  <p>and I get</p>
  
  <pre><code>'testäch\\u57faer'
  </code></pre>
  
  <p>So how do I get my 基 back? I'm getting nearly there by using decode("unicode-escape") instead (it would work for this example), but that assumes bytes encoded with iso8859-1 not cp1252, so any characters between 80 and 9F would be wrong.</p>