Improve Python 3 support (tracebacks are linked again)

- Add Python 3.4 support around issue #27.
- urllib.parse.quote instead of urllib.quote
- don't set encoding on sys.stdout/sys.stderr (already UTF-8)
- use open('w') instead of fdopen('wb') so we can write UTF-8 strings instead of bytes
- safely test unicode-ness, only encode to UTF-8 in Python 2.x