On 25.04.21 10:44, Holger Jakobs wrote:
The point is that the XML standard dictates that every document without an explicit encoding, must be encodied in UTF-8. So, whenever you want to use a different encoding, this has to be stated in the XML header, as indicated in Tom Lane's answer.
If you are transmitting an XML datum from the client to the server in the text protocol, then the encoding declaration is ignored. See this documentation:
https://www.postgresql.org/docs/devel/datatype-xml.html#id-1.5.7.21.7