I'm developing a CMS for a customer and he needs to edit stuff and use special characters such as ç
and ®
. However, I don't want him to have to enter the character codes like ®
. Does anyone knows a good way to automatically convert those characters using PHP?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Is there a way to play audio on a mobile browser w
The easiest would be to use UTF-8 right from the start.
But you can also automatically convert characters with DOM:
outputs
You can use htmlentities() to do that.
To turn entities back to readable text, use html_entity_decode():
If you're not using unicode, omit the charset name or give the correct charset.
You can use:
htmlentities
Take a look at the htmlentities function. This takes a string and converts component characters into their HTML entities. You can specify the encoding of the string to be consistent with the user's input.
Use unicode, and show him how to copy&paste from character map :-)