Commits

Vinay Sajip  committed 1e5b3ac Draft

Closes #51: Use utf-8 for shebang encoding.

  • Participants
  • Parent commits e231db5

Comments (0)

Files changed (1)

File distlib/scripts.py

 import struct
 import sys
 
-from .compat import sysconfig, fsencode, detect_encoding, ZipFile
+from .compat import sysconfig, detect_encoding, ZipFile
 from .resources import finder
 from .util import (FileOperator, get_export_entry, convert_path,
                    get_executable, in_venv)
         # cater for executable paths with spaces (not uncommon on Windows)
         if enquote and ' ' in executable:
             executable = '"%s"' % executable
-        executable = fsencode(executable)
+        # Issue #51: don't use fsencode, since we later try to
+        # check that the shebang is decodable using utf-8.
+        executable = executable.encode('utf-8')
         # in case of IronPython, play safe and enable frames support
         if (sys.platform == 'cli' and '-X:Frames' not in post_interp
             and '-X:FullFrames' not in post_interp):