0

Using php version 7.4.1. Tried to convert the below data to JSON, but it neither returned anything nor any error shown. Could you please advise how to handle the superscript char 'tm' while JSON encoding?

$a['code']     ='hello';
$a['name']      = 'All categories';
$a2 = array("catid"=>140,"catName"=>'Silk Touch™');
$a['options']    = $a2;

echo "JsonData: ",  json_encode($a), "\n";
user40991
  • 173
  • 1
  • 3
  • 11
  • 1
    "nor any error shown"...did you actually look for an error? What was the result of checking for an error using [json_last_error_msg()](https://www.php.net/manual/en/function.json-last-error-msg.php)? Your code doesn't seem to include that step. – ADyson Dec 03 '20 at 12:24
  • 2
    Works fine here, try converting your source code file to UTF-8 if it is not already – RiggsFolly Dec 03 '20 at 12:30

0 Answers0