DOC, FIX: Explicit encoding for opened files in gen_rst.py

The encoding (if not specified) used by `open` in Python is platform dependent. On my Windows machine it is `cp1251`, so I had troubles building docs with the example gallery because of that (some examples contain non-ASCII characters.) 

I think setting it explicitly to `utf-8` is a good thing.