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