Ma Lin <malin...@163.com> added the comment:
IMO "xmlcharrefreplace" is useful for Web application. For example, the page's charset is "gbk", then this statement can generate the bytes content easily & safely: s.encode('gbk', 'xmlcharrefreplace') Maybe some HTML-related frameworks use this way to escape characters, such as Sphinx [1]. Attached file `error_handers_fast_paths.txt` summarized all current error-handler fast-paths. [1] Sphinx use 'xmlcharrefreplace' to escape https://github.com/sphinx-doc/sphinx/blob/e65021fb9b0286f373f01dc19a5777e5eed49576/sphinx/builders/html/__init__.py#L1029 ---------- Added file: https://bugs.python.org/file49324/error_handers_fast_paths.txt _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41330> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com