UTF-8 validation

When the string is already UTF-8, the output came out wrong, i have this patch to fix it.
It validates is the string is UTF-8 or not.