title: python3 subprocess returning local encoding bytes makes information lost
body: <p>This is my code:</p>
  
  <pre><code># -*- coding: utf-8 -*-
  import subprocess as sp
  import locale
  
  LOCAL_ENCODING = locale.getpreferredencoding()
  
  cmds = ['dir', '/b', '*.txt']
  
  out = sp.check_output(cmds, shell=True)
  print(out)
  print(out.decode(LOCAL_ENCODING))
  
  s = 'レミリア・スカレート.txt'
  print(s.encode(LOCAL_ENCODING, 'replace'))
  print(LOCAL_ENCODING)
  # print(s.encode('utf-8'))
  </code></pre>
  
  <p>This is the output:</p>
  
  <pre><code>b'\xa5\xec\xa5\xdf\xa5\xea\xa5\xa2?\xa5\xb9\xa5\xab\xa5\xec\xa9`\xa5\xc8.txt\r\n'
  レミリア?スカレート.txt
  
  b'\xa5\xec\xa5\xdf\xa5\xea\xa5\xa2?\xa5\xb9\xa5\xab\xa5\xec\xa9`\xa5\xc8.txt'
  cp936
  </code></pre>
  
  <p>(A text file named <code>'レミリア・スカレート.txt'</code> is in the script directory.)</p>
  
  <p>As the result shows, the bytes of the file name returned  <strong>has been automatically encoded by local encoding</strong>, which can't totally encode the filename(Note the <code>?</code> in the bytes), thus some information lost.</p>
  
  <blockquote>
    <p>Environment:<br>
    - win10 Chinese Simplified<br>
    - python-3.5.1 </p>
  </blockquote>
  
  <p><strong>My question is:</strong><br>
  Is it possible to avoid the automatical local-encoding and get an utf-8(or some other specified encoding) bytes?<br>
  I read this <a href="https://bugs.python.org/issue6135" rel="nofollow">issue</a>, but got no solution :-(</p>
  
  <hr>
  
  <p><strong>1.For built-in command, solved by eryksun's answer:</strong>    </p>
  
  <blockquote>
    <p><code>out = sp.check_output('cmd.exe /u /c "dir /b *.txt"').decode('utf-16le')</code>,<br>
    <code>/u</code>: Output UNICODE characters (UCS-2 le),<br>
    <code>/c</code>: Run Command and then terminate)   </p>
  </blockquote>
  
  <p><strong>2.For external programs:[no general solution]</strong><br>
  configure the output using proper encoding(by setting exteral programs' options or configurations, of course, <em>such options may be nonexistent</em>),<br>
  for example, in the latest winrar, one can set the encoding of console rar messages:<code>rar lb -scur data &gt; list.txt</code>, will produce Unicode list.txt with archived file names</p>