Add support for html entities

Change to respect php coding standards
Change javascript code to decode also html entities