encode per doctype
Merge pull request #16 from Trott/encoding

encode per doctype