Fix encoding error
diff --git a/docs/autogen.py b/docs/autogen.py
index 22964a17a26..d6f8b4bff65 100644
--- a/docs/autogen.py
+++ b/docs/autogen.py
@@ -269,7 +269,7 @@ def add_np_implementation(function, docstring):
 
 
 def read_file(path):
-    with open(path) as f:
+    with open(path, encoding='utf-8') as f:
         return f.read()
 
 
@@ -326,7 +326,7 @@ def get_module_docstring(filepath):
 
     Also finds the line at which the docstring ends.
     """
-    co = compile(open(filepath).read(), filepath, 'exec')
+    co = compile(open(filepath, encoding='utf-8').read(), filepath, 'exec')
     if co.co_consts and isinstance(co.co_consts[0], six.string_types):
         docstring = co.co_consts[0]
     else:
@@ -347,8 +347,9 @@ def copy_examples(examples_dir, destination_dir):
         module_path = os.path.join(examples_dir, file)
         docstring, starting_line = get_module_docstring(module_path)
         destination_file = os.path.join(destination_dir, file[:-2] + 'md')
-        with open(destination_file, 'w+') as f_out, \
-                open(os.path.join(examples_dir, file), 'r+') as f_in:
+        with open(destination_file, 'w+', encoding='utf-8') as f_out, \
+                open(os.path.join(examples_dir, file),
+                     'r+', encoding='utf-8') as f_in:
 
             f_out.write(docstring + '\n\n')
 
@@ -391,7 +392,7 @@ def generate(sources_dir):
     readme = read_file(os.path.join(str(keras_dir), 'README.md'))
     index = read_file(os.path.join(template_dir, 'index.md'))
     index = index.replace('{{autogenerated}}', readme[readme.find('##'):])
-    with open(os.path.join(sources_dir, 'index.md'), 'w') as f:
+    with open(os.path.join(sources_dir, 'index.md'), 'w', encoding='utf-8') as f:
         f.write(index)
 
     print('Generating docs for Keras %s.' % keras.__version__)
@@ -457,7 +458,7 @@ def generate(sources_dir):
         subdir = os.path.dirname(path)
         if not os.path.exists(subdir):
             os.makedirs(subdir)
-        with open(path, 'w') as f:
+        with open(path, 'w', encoding='utf-8') as f:
             f.write(mkdown)
 
     shutil.copyfile(os.path.join(str(keras_dir), 'CONTRIBUTING.md'),

<!--
Please make sure you've read and understood our contributing guidelines;
https://github.com/keras-team/keras/blob/master/CONTRIBUTING.md

Note:
We are no longer adding new features to multi-backend Keras (we only fix bugs), as we are refocusing development efforts on tf.keras. If you are still interested in submitting a feature pull request, please direct it to tf.keras in the TensorFlow repository instead.
-->

### Summary
Running `autogen.py` in Windows fails with the following error:
`UnicodeDecodeError: 'cp949' codec can't decode byte 0xbf in position 2: illegal multibyte sequence
`

Passing `utf-8` encoding argument fixes the error. 

### Related Issues

### PR Overview

- [n] This PR requires new unit tests [y/n] (make sure tests are included)
- [n] This PR requires to update the documentation [y/n] (make sure the docs are up-to-date)
- [y] This PR is backwards compatible [y/n]
- [n] This PR changes the current API [y/n] (all API changes need to be approved by fchollet)
