0
votes

Is it possible to disable automatic unicode decode conversion of py3 configparser when reading ini files? I'd prefer configparser to return encoded str bytes values (like in py2 ConfigParser) rather than decoded str unicode.

configparser.get(section, param)
'ั‚ะตัั‚'

Desired behavior:

configparser.get(section, param)
b'\xd1\x82\xd0\xb5\xd1\x81\xd1\x82'
1
My reasoning for this is that, in this program (TCP server) i only deal with encoded string bytes, and have no use of Unicode strings. - hmiller

1 Answers

0
votes

This seems to be a problem because py3 configparser cannot read file in BINARY mode, but rather files must be opened in TEXT mode, yielding Unicode strings (rather than bytes) using default encoding.