Avoid warnings for and detect the problemWarning: json_encode(): Invalid UTF-8 sequence in argument occurred