Issue #25047: Respect case writing XML encoding declarations

This restores the ability to write encoding names in uppercase like "UTF-8",
which worked in Python 2.
3 files changed