Set prompt encoding to a sane value when sys.stdout.encoding is None

Fixes #8644