I have a self made text-editor, with a feature whereby you can insert unicode characters onto a (editable) div. For example a speaker-icon is represented by the following string:
🔊
and after inserting this string as a textnode it will directly be rendered correctly within the div as
🔊
When I export the content of my editor I basically submit the div.innerHTML and store in the mysql database.
I however want the innerHTML to preserve/keep the hex representation of the character instead of the rendered version, for example an output string like
this is a <span style='color:green'>speaker-icon: 🔊</span> in my message.
The reason is that in mysql the icon is else stored as '???' . Mysql uses utf8mb4_general_ci as collation. Also I want to keep the HTML as portable as possible regardless of collation.
Is this possible?
PS I am using PHP as back-end.