Updated String.entityEncode method to account for already encoded entities. 

This should avoid double-encoding already encoded values, such as `&amp;`; otherwise, it would become `&amp;amp;`