(#1621, #2152, #2529) Allow setting custom input/output encodings and options without having to rely on Python's defaults.