json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT json json

json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT


Before you JSON encode, use utf8_encode() around the string.


You can just set this in your connection also:

$result = sqlsrv_connect($hostname, array(    'UID' => $username,    'PWD' => $password,    'Database' => $database,    "CharacterSet" => "UTF-8"   // <---- here the magic happens ));

For me, this is the easer way.