What does it actually do? On my very basic level of understanding XML is just a formatted text. So there is no binary<->text transformation involved.
I highly suspect that the only difference between UTF-8 and ASCII encoding is that ASCII encoding will make XML writer work harder by converting all the non-ASCII characters into XML entities as opposed to just reserved XML characters. So ASCII encoded XML can still contain UTF-8 characters, except it is going to be slightly longer and uglier.
Or is there some other function to it?
Update:
I perfectly understand how individual characters are converted into byte(s) by means of encoding. However XML is just text markup and at no point does that.
The question really is why XML encoding value is stored in the XML? Or what is the case where XML reader would need to know which encoding was used for any particular XML document?