cakephp 2.4 - invalid character in json response -
in cakephp controller send json response with
$response = array('success' => 1); return json_encode($response);
i alway getting wrong json in view: syntaxerror: json.parse: unexpected character have tested jslint, error "unsafe character" char 0 line 1 firebug console output returns 65279 following statement.
console.log(response.charcodeat(0));
what can do? utf-8 issue?
you may have character 
in json string unicode character zero width no-break space (u+feff)
. may copied code via copy/paste without realizing it. not visible hard debug. try copy $response text text editor , erase space.
here post may related. https://stackoverflow.com/a/9691839/2777098
Comments
Post a Comment