Fix and test for GRAILS-11078 encodeAsHTML() causes unexpected null behavior
- improve 81fe4c4f commit related to GRAILS-10980