pallets / flask

The Python micro framework for building web applications.
https://flask.palletsprojects.com
BSD 3-Clause "New" or "Revised" License
67.5k stars 16.14k forks source link

Add encoding parameter to open resource #5526

Closed Lopkop closed 1 month ago

Lopkop commented 2 months ago

This PR fixes #5504

davidism commented 1 month ago

Thanks for getting this started. I've made the change to open_instance_resource and Blueprint.open_resource as well; added version markers, added a change log, and refactored the docs and tests a bit.

I also decided to default to encoding="utf-8" (and ignore it in binary mode) rather than None. Might as well make the behavior of open consistent across machines even if open itself can't change.