This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients eryksun, ezio.melotti, rushant, terry.reedy, vstinner
Date 2021-03-26.23:12:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1616800324.51.0.386656629734.issue43576@roundup.psfhosted.org>
In-reply-to
Content
Python works as expected: the UTF-8 codec doesn't allow to encode surrogate characters.

Surrogate characters are coming from os.environ['a'] because this environment variable contains bytes which cannot be decoded from the sys.getfilesystemencoding().

You should fix your system setup, especially the locale encoding. The strings stored in the "a" environment variable was not encoded to the Python filesystem encoding:
https://docs.python.org/dev/glossary.html#term-filesystem-encoding-and-error-handler

If you are lost with locale encodings, you can attempt to encode everything in UTF-8 and enables the Python UTF-8 Mode:
https://docs.python.org/dev/library/os.html#python-utf-8-mode

Good luck with your setup ;-)

Hint: use print(ascii(job_name)) to dump the string content.
History
Date User Action Args
2021-03-26 23:12:04vstinnersetrecipients: + vstinner, terry.reedy, ezio.melotti, eryksun, rushant
2021-03-26 23:12:04vstinnersetmessageid: <1616800324.51.0.386656629734.issue43576@roundup.psfhosted.org>
2021-03-26 23:12:04vstinnerlinkissue43576 messages
2021-03-26 23:12:04vstinnercreate