LPS-43171 changed the encode logic according to html5 rule