You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Converting a render error to a string fails for a non-UTF-8 template file #450
TemplateError.__str__ and ExceptionFormatter.__call__ in exc.py re-read the template file with a bare open() to show the source lines, which uses the locale encoding. Only OSError is caught, and the decode error happens later, while iterating the file. So logging or a framework's error page loses the original message.
PR to follow: read the lines as UTF-8 with errors='replace'.
Reproduced on master (90b9002) with Python 3.13 and 3.15.
Activity
Don't fail formatting an error for a non-UTF-8 template file