I encode array of objects to cookie in JS:
prod.name = name;
prod.id = id;
prod.price = cost;
prod.quantity = 1;
Products = [prod];
Cookies.set('cart', Products);
And name looks like "Some product name", but when i'm doing same thing from PHP:
setcookie('products', json_encode($Products));
I got name like "Some+product+name" - is there any way to avoid it, or the only way is to str_replace() + with " " (what is unicode analog for theme)?
UPD. To be simple:
If I setcookie ('cartNew', json_encode(['name' => "Some product name"])); - in cookie I see "+", and JS decode that as "+". Cookie is like %7B%22name%22%3A%22Some+product+name%22%7D - firefox. Also I use UTF-8, and php 5.4
$Productsvalue. thanks$Productsvalue here in your code for solution. thanks.