encoding/xml decoder with Strict=false does not handle unknown character entities properly

75 views
Skip to first unread message

Denis Defreyne

unread,
Mar 30, 2012, 5:58:28 PM3/30/12
to golan...@googlegroups.com
Hi all,

I have found some odd behavior of the XML parser in Go. When setting Strict to false (so that it doesn’t error on unknown character entities), the trailing ';' character is not appended when it should be. For example, when parsing "Hello Bye", the actual data is "Hello&nbspBye". A test case can be found at https://gist.github.com/2255738.

I believe that in http://golang.org/src/pkg/encoding/xml/xml.go lines 880 and 912 should be followed by a d.buf.WriteByte(';'). Does this sound right?

Regards,

Denis

Denis Defreyne

unread,
Mar 31, 2012, 3:00:28 PM3/31/12
to golan...@googlegroups.com
For those interested: http://code.google.com/p/go/issues/detail?id=3447

Op vrijdag 30 maart 2012 23:58:28 UTC+2 schreef Denis Defreyne het volgende:
Reply all
Reply to author
Forward
0 new messages