I've attached a patch that I think addresses the issues. Since the encoder handles character entities, I think it makes sense that the DefaultServiceException handler always call OwsUtils.dumpExceptionMessages with xmlEscape false. The tests in the attached patch show how special characters are not round-tripped unless xmlEscape is false.
Changing this, the other DefaultServiceException tests fail. I think this is due to r9240 (came with
GEOS-1936). Only if xmlEscape is true is msg appended, otherwise t.next() is appended. This causes issue when !t.hasNext().
Thanks for any review.