if you're talking about encoding to "hide" the data - use base64_encode and base64_decode.
Respectfully, Ligaya Turmelle
Brian Dunning wrote:
I have a form where people input some text, which is then incorporated into an HTML snippet which appears in a textarea for them to copy & paste into a web page.
People will be entering foreign language stuff as well as special characters like copyright, so I have to be sure this is handled properly.
I tried rawurlencode() but that results in HTML which displays the encoding when they paste it into their web page. I tried htmlentities but that gives different characters than what they typed when displayed in the textarea. I also tried no encoding, which worked well, except that it gets messed up when I try to write it to the database and I have the same problem again when retrieving it.
"Cañon ©" is a good example.
htmlentities('Cañon ©') -> Cañon © in the textarea, displays on their web page as Cañon ©
rawurlencode('Cañon ©') -> Ca%C3%B1on%20%C2%A9 in the textarea, displays on their web page as Ca%C3%B1on%20%C2%A9from the database.
No encoding gives Cañon © in the textarea and displays on their web page as Cañon ©, but appears in the database as Cañon ©
How can I handle this so that what ultimately displays on their web page, after copying the HTML out of the textarea, matches what they typed in the form, and yet can be read & written from the database properly?
- Brian
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php