[common] catch UnicodeEncodeError and instruct users to change the locale

This commit is contained in:
Mort Yao 2016-03-10 22:48:35 +01:00
parent 6590bb33cd
commit 225f18d347

View File

@ -1183,6 +1183,14 @@ def script_main(script_name, download, download_playlist, **kwargs):
raise raise
else: else:
sys.exit(1) sys.exit(1)
except UnicodeEncodeError:
log.e('[error] oops, the current environment does not seem to support Unicode.')
log.e('please set it to a UTF-8-aware locale first,')
log.e('so as to save the video (with some Unicode characters) correctly.')
log.e('you can do it like this:')
log.e(' (Windows) % chcp 65001 ')
log.e(' (Linux) $ LC_CTYPE=en_US.UTF-8')
sys.exit(1)
except Exception: except Exception:
if not traceback: if not traceback:
log.e('[error] oops, something went wrong.') log.e('[error] oops, something went wrong.')