bpo-44349: Fix edge case when displaying text from files with encoding in syntax errors (GH-26611) (GH-26616)

(cherry picked from commit 9fd21f649d66dcb10108ee395fd68ed32c8239cd)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
3 files changed