XeTK/JavaBot — pull request #127 by ODyckhoff (2014-08-08 11:25:21+00:00)
Title: Added a WebUtils class for plugin.web classes.

I added a WebUtils class that currently only contains a method (public static final String unescapeHTML(final String input)) to take a String of text, and convert any HTML entities, e.g. `&`, `<` etc, into their expanded equivalents, ie. `&` and `<` respectively.

The WebUtils class has been imported into all the web plugin sources, and I have made use of the HTML unescaping to process web page titles, and to sanitise the lyrics that are fetched as part of the youtube plugin.

Note: currently I have only tested by temporarily putting a "main" method in the WebUtils, and passing a HTML entity string into the program via command line arguments. However, strings containing a single HTML entity, multiple entities, and a mixture of normal text and HTML entities are all processed and returned correctly, so the plugins shouldn't have issues with it. Unknown HTML entity codes are left as-is.