#814: set binary mode only for compressed files (encoding is not None)