Missing docstring for canonical_order parameter
Test write() using DOM
Fix bug that crashes when there's non-ASCII chars