I want to take a string and store it in a MYSQL db. This string will be a HTML string and it can have any character encoding or be written in any language.
How can I safely save this in my MYSQL DB without affecting the HTML string so that I can later retrieve it as it is?
In addition, the field it will be stored in is of data type text and has a collation of latin1_swedish_ci will this effect it in anyway?
I am currently doing this:
htmlentities($html, ENT_QUOTES, 'UTF-8')
But I don’t think the above will work for all character sets. I mean how will German or Japanese characters be affected?
Thanks for any help.
Why not base64 encode it for storage, and then decode it after?