Unit tests for Xmf, also some fixes for issues found along the way
Convert to UTF-8 (was ISO 8859-1)
Use standard PHP filter_var for checkEmail

Standard FILTER_VALIDATE_EMAIL now handles email quite well, including edge cases that current routines didn't.

Also added some extended cases in unit test.
Correct issues highlighted by scrutinizer
Reduce duplication
One more fix for scrutinizer issue
Merge pull request #138 from geekwright/master

Add Xmf unit tests.