encode xml text in utf-8 (as it also declares this encoding)
use etreeutil.indent to prettyprint xml instead of reparsing using xml.minidom

also changes tabs to spaces in the python code