Fix escaping of strings containing ISO characters.

PHP 5.4 changed the default encoding for htmlspecialchars and
htmlentities to be UTF-8, and doesn't use default_charset until 5.6.

This commit fixes the most obvious problems, in the API, search, and
alert signup; there may well be others, and it might be simplest to
replace all uses of the two fucntions with the wrappers for consistency.

Fixes #581.