php - how to serialize svg so it can fit into a cookie -


I need to sort a svg image so that it can be stored in a cookie.

I need this to set cookies, and then when they come back, make the STVG image uncertain.

So basically my problems come down to sort SVG into things that can be stored in a cookie. How can I do this?

I know that serialize () and unserialize () in php but serialize takes in mixed value and i'm not sure that svg will come in that category.

I did a little research on mixed values ​​and it seems to be in this struct , array s, int , etc. But STVG can not, if I am wrong about this, please tell me, because serializing and unseariing will be much easier.

Thank you.

OK, scalable vector graphics are just XML and therefore just text (usually UTF-8 encoded , Although it should be similar to ASCII unless you explicitly add any non-ASCII characters). Still there will be special characters in a SVG string which are not in the cookie, so you have to save it (semi-colon, comma and space should run away, if I remember correctly, you can use urlencode function from php) . All this takes on the aspect of the serialization. Big problem size limit can be: Cookie 40 9 6 should not be more than 6 characters, including the length of the name. For a more complex SVG it can be very low.

Comments