Open the files in binary mode, and remove the redundant encode
Closes https://github.com/espressif/esp-idf/issues/5785