I am converting a site database into a database of Joomla K2 components. K2 has extra_fields columns that the user can create custom fields similar to the Drupal CCK. So I used this function to keep the source of the source in the field. {"id":"7", "value":"Text"}
but when I use json_encode "ارتباطات و اطلاع رساني" or something else instead of getting
{"id":7,"value":"\u0627\u0631\u062a\u0628\u0627\u0637\u0627\u062a \u0648 \u0627\u0637\u0644\u0627\u0639 \u0631\u0633\u0627\u0646\u064a"}
which I see in my local host, I:
{"id":"7","value":"u0631u0648u0627u0628u0637 u0639u0645u0648u0645u064a"}
when data is inserted into the database
UPDATE:
There are no slashes in that I'm trying to use json_encode
I wrote php code to read from a table and then converted the data and pasted it into another table
script that I use to create json_encoded data from my source:
if($this->source[$i]){ $this->source[$i] = trim($this->source[$i]); $this->extrafield[$i] = array("id"=>"7", "value"=>$this->source[$i]); $this->extrafield[$i] = json_encode($this->extrafield[$i]); }
UPDATE 2:
I think I solved my problem. check the answer.
source share