Always encode text-based scripts to UTF-8. Fixes #1246.
diff --git a/CHANGES.rst b/CHANGES.rst
index 737cc0f..b64edc6 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,3 +1,8 @@
+v38.5.0
+-------
+
+* #1246: ``easy_install`` now always writes scripts out in UTF-8.
+
 v38.4.0
 -------
 
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index b7396b8..7f8c54d 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -828,14 +828,15 @@
         target = os.path.join(self.script_dir, script_name)
         self.add_output(target)
 
-        if not self.dry_run:
+        if self.dry_run:
             return
 
         mask = current_umask()
         ensure_directory(target)
         if os.path.exists(target):
             os.unlink(target)
-        with open(target, "w" + mode) as f:
+        encoding = 'utf-8' if mode == 't' else None
+        with io.open(target, "w" + mode, encoding=encoding) as f:
             f.write(contents)
         chmod(target, 0o777 - mask)