We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Explicitly set encoding for reading history file.
Fixes build in C locale. Otherwise I see:

Traceback (most recent call last):
  File "setup.py", line 24, in <module>
    history = history_file.read().replace('.. :changelog:', '')
  File "/usr/pkg/lib/python3.5/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 6348: ordinal not in range(128)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 #!/usr/bin/env python
2 
3 import os
4 import sys
5 
6 from setuptools import setup
7 
8 version = "1.3.0"
9 
10 if sys.argv[-1] == 'publish':
11     os.system('python setup.py sdist upload')
12     os.system('python setup.py bdist_wheel upload')
13     sys.exit()
14 
15 if sys.argv[-1] == 'tag':
16     os.system("git tag -a %s -m 'version %s'" % (version, version))
17     os.system("git push --tags")
18     sys.exit()
19 
20 with open('README.rst') as readme_file:
21     readme = readme_file.read()
22 
23 with open('HISTORY.rst') as history_file:
24     history = history_file.read().replace('.. :changelog:', '')
25 
26 requirements = [
27     'future>=0.15.2',
28     'binaryornot>=0.2.0',
29     'jinja2>=2.7',
30     'click>=5.0',
31     'whichcraft>=0.1.1',
32     'poyo>=0.1.0'
33 ]
34 
35 long_description = readme + '\n\n' + history
36 
37 if sys.argv[-1] == 'readme':
38     print(long_description)
39     sys.exit()
40 
41 
42 setup(
43     name='cookiecutter',
44     version=version,
45     description=('A command-line utility that creates projects from project '
46                  'templates, e.g. creating a Python package project from a '
47                  'Python package project template.'),
48     long_description=long_description,
49     author='Audrey Roy',
50     author_email='audreyr@gmail.com',
51     url='https://github.com/audreyr/cookiecutter',
52     packages=[
53         'cookiecutter',
54     ],
55     package_dir={'cookiecutter': 'cookiecutter'},
56     entry_points={
57         'console_scripts': [
58             'cookiecutter = cookiecutter.cli:main',
59         ]
60     },
61     include_package_data=True,
62     install_requires=requirements,
63     license='BSD',
64     zip_safe=False,
65     classifiers=[
66         'Development Status :: 5 - Production/Stable',
67         'Environment :: Console',
68         'Intended Audience :: Developers',
69         'Natural Language :: English',
70         'License :: OSI Approved :: BSD License',
71         'Programming Language :: Python',
72         'Programming Language :: Python :: 2',
73         'Programming Language :: Python :: 2.7',
74         'Programming Language :: Python :: 3',
75         'Programming Language :: Python :: 3.3',
76         'Programming Language :: Python :: 3.4',
77         'Programming Language :: Python :: 3.5',
78         'Programming Language :: Python :: Implementation :: CPython',
79         'Programming Language :: Python :: Implementation :: PyPy',
80         'Topic :: Software Development',
81     ],
82     keywords=(
83         'cookiecutter, Python, projects, project templates, Jinja2, '
84         'skeleton, scaffolding, project directory, setup.py, package, '
85         'packaging'
86     ),
87 )
88
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,7 @@
 #!/usr/bin/env python
 
 import os
+import io
 import sys
 
 from setuptools import setup
@@ -17,10 +18,10 @@
     os.system("git push --tags")
     sys.exit()
 
-with open('README.rst') as readme_file:
+with io.open('README.rst', 'r', encoding='utf-8') as readme_file:
     readme = readme_file.read()
 
-with open('HISTORY.rst') as history_file:
+with io.open('HISTORY.rst', 'r', encoding='utf-8') as history_file:
     history = history_file.read().replace('.. :changelog:', '')
 
 requirements = [

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -1,6 +1,7 @@\n #!/usr/bin/env python\n \n import os\n+import io\n import sys\n \n from setuptools import setup\n@@ -17,10 +18,10 @@\n     os.system(\"git push --tags\")\n     sys.exit()\n \n-with open('README.rst') as readme_file:\n+with io.open('README.rst', 'r', encoding='utf-8') as readme_file:\n     readme = readme_file.read()\n \n-with open('HISTORY.rst') as history_file:\n+with io.open('HISTORY.rst', 'r', encoding='utf-8') as history_file:\n     history = history_file.read().replace('.. :changelog:', '')\n \n requirements = [\n", "issue": "Explicitly set encoding for reading history file.\nFixes build in C locale. Otherwise I see:\n\nTraceback (most recent call last):\n  File \"setup.py\", line 24, in <module>\n    history = history_file.read().replace('.. :changelog:', '')\n  File \"/usr/pkg/lib/python3.5/encodings/ascii.py\", line 26, in decode\n    return codecs.ascii_decode(input, self.errors)[0]\nUnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 6348: ordinal not in range(128)\n\n", "before_files": [{"content": "#!/usr/bin/env python\n\nimport os\nimport sys\n\nfrom setuptools import setup\n\nversion = \"1.3.0\"\n\nif sys.argv[-1] == 'publish':\n    os.system('python setup.py sdist upload')\n    os.system('python setup.py bdist_wheel upload')\n    sys.exit()\n\nif sys.argv[-1] == 'tag':\n    os.system(\"git tag -a %s -m 'version %s'\" % (version, version))\n    os.system(\"git push --tags\")\n    sys.exit()\n\nwith open('README.rst') as readme_file:\n    readme = readme_file.read()\n\nwith open('HISTORY.rst') as history_file:\n    history = history_file.read().replace('.. :changelog:', '')\n\nrequirements = [\n    'future>=0.15.2',\n    'binaryornot>=0.2.0',\n    'jinja2>=2.7',\n    'click>=5.0',\n    'whichcraft>=0.1.1',\n    'poyo>=0.1.0'\n]\n\nlong_description = readme + '\\n\\n' + history\n\nif sys.argv[-1] == 'readme':\n    print(long_description)\n    sys.exit()\n\n\nsetup(\n    name='cookiecutter',\n    version=version,\n    description=('A command-line utility that creates projects from project '\n                 'templates, e.g. creating a Python package project from a '\n                 'Python package project template.'),\n    long_description=long_description,\n    author='Audrey Roy',\n    author_email='audreyr@gmail.com',\n    url='https://github.com/audreyr/cookiecutter',\n    packages=[\n        'cookiecutter',\n    ],\n    package_dir={'cookiecutter': 'cookiecutter'},\n    entry_points={\n        'console_scripts': [\n            'cookiecutter = cookiecutter.cli:main',\n        ]\n    },\n    include_package_data=True,\n    install_requires=requirements,\n    license='BSD',\n    zip_safe=False,\n    classifiers=[\n        'Development Status :: 5 - Production/Stable',\n        'Environment :: Console',\n        'Intended Audience :: Developers',\n        'Natural Language :: English',\n        'License :: OSI Approved :: BSD License',\n        'Programming Language :: Python',\n        'Programming Language :: Python :: 2',\n        'Programming Language :: Python :: 2.7',\n        'Programming Language :: Python :: 3',\n        'Programming Language :: Python :: 3.3',\n        'Programming Language :: Python :: 3.4',\n        'Programming Language :: Python :: 3.5',\n        'Programming Language :: Python :: Implementation :: CPython',\n        'Programming Language :: Python :: Implementation :: PyPy',\n        'Topic :: Software Development',\n    ],\n    keywords=(\n        'cookiecutter, Python, projects, project templates, Jinja2, '\n        'skeleton, scaffolding, project directory, setup.py, package, '\n        'packaging'\n    ),\n)\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\n\nimport os\nimport io\nimport sys\n\nfrom setuptools import setup\n\nversion = \"1.3.0\"\n\nif sys.argv[-1] == 'publish':\n    os.system('python setup.py sdist upload')\n    os.system('python setup.py bdist_wheel upload')\n    sys.exit()\n\nif sys.argv[-1] == 'tag':\n    os.system(\"git tag -a %s -m 'version %s'\" % (version, version))\n    os.system(\"git push --tags\")\n    sys.exit()\n\nwith io.open('README.rst', 'r', encoding='utf-8') as readme_file:\n    readme = readme_file.read()\n\nwith io.open('HISTORY.rst', 'r', encoding='utf-8') as history_file:\n    history = history_file.read().replace('.. :changelog:', '')\n\nrequirements = [\n    'future>=0.15.2',\n    'binaryornot>=0.2.0',\n    'jinja2>=2.7',\n    'click>=5.0',\n    'whichcraft>=0.1.1',\n    'poyo>=0.1.0'\n]\n\nlong_description = readme + '\\n\\n' + history\n\nif sys.argv[-1] == 'readme':\n    print(long_description)\n    sys.exit()\n\n\nsetup(\n    name='cookiecutter',\n    version=version,\n    description=('A command-line utility that creates projects from project '\n                 'templates, e.g. creating a Python package project from a '\n                 'Python package project template.'),\n    long_description=long_description,\n    author='Audrey Roy',\n    author_email='audreyr@gmail.com',\n    url='https://github.com/audreyr/cookiecutter',\n    packages=[\n        'cookiecutter',\n    ],\n    package_dir={'cookiecutter': 'cookiecutter'},\n    entry_points={\n        'console_scripts': [\n            'cookiecutter = cookiecutter.cli:main',\n        ]\n    },\n    include_package_data=True,\n    install_requires=requirements,\n    license='BSD',\n    zip_safe=False,\n    classifiers=[\n        'Development Status :: 5 - Production/Stable',\n        'Environment :: Console',\n        'Intended Audience :: Developers',\n        'Natural Language :: English',\n        'License :: OSI Approved :: BSD License',\n        'Programming Language :: Python',\n        'Programming Language :: Python :: 2',\n        'Programming Language :: Python :: 2.7',\n        'Programming Language :: Python :: 3',\n        'Programming Language :: Python :: 3.3',\n        'Programming Language :: Python :: 3.4',\n        'Programming Language :: Python :: 3.5',\n        'Programming Language :: Python :: Implementation :: CPython',\n        'Programming Language :: Python :: Implementation :: PyPy',\n        'Topic :: Software Development',\n    ],\n    keywords=(\n        'cookiecutter, Python, projects, project templates, Jinja2, '\n        'skeleton, scaffolding, project directory, setup.py, package, '\n        'packaging'\n    ),\n)\n", "path": "setup.py"}]}