Handle case where sys.stdin.encoding is read-only