fix attribute value encoding

Attribute values need to be encoded in the output, since they are
decoded by the parser.  Without this, attribute values can be
constructed to include pretty much anything in the output.
Merge pull request #20 from haarg/attr-val-encode

fix attribute value encoding