feat #1132 Add env. parameter for escapeforhtml (feature + test)

___This PR is based on #1133.___

It combines two commits: 

- the one from PR #1133: please refer to it for more information
- an additional one to add missing tests