StringEscapeUtils escapeHtml

mathematician picture mathematician · Feb 28, 2013 · Viewed 7.7k times · Source

Is there a difference between org.apache.commons.lang.StringEscapeUtils.escapeHtml and org.apache.commons.lang3.StringEscapeUtils.escapeHtml4 ?

Answer

P.Nichols picture P.Nichols · Feb 28, 2013

they come from different packages in fact

escapeHtml comes from org.commons.lang (lang 2.5 API) and let's you use a writer object. It can also escape string from an SQL source

escapeHtml4 is from org.commons.lang3 (lang 3.1 API) is specialy use to escape character from a HTML4 source. Nothing more, nothing less

They do the same job but i would recommend using "escapeHtml4" since its from a newer package

See : EscapeHtml4 and escapehtml