UnicodeDecodeError if stdin encoding is not utf-8

UnicodeDecodeError is raised if standard input encoding is not utf-8 (ie. on Windows).
This PR is using `sys.stdin.encoding` to decode input.