I have a PHP page receiving input from an HTML form via $_POST. The strings in $_POST have quotes and backslashes escaped with ‘\’. I don’t know what else it will escape/encode. I’d like to have exactly what the user typed (as UTF-8 ideally) and I’m sure there’s some simple function to do this, but I’m not sure which is the right one.
I know I have to be careful with this when I insert it into a database, or return it in the middle of some HTML, but in my code I’d like to have my hands on exactly what the user typed.
EDIT: magic_quotes_gpc was escaping some things, but even after removing that I still get HTML entities like Ą from $_POST. Is there a simple way to decode $_POST back to the original user input (preferably in UTF-8)?
Try PHP’s stripslashes function.
Just a side note, it sounds like you have magic_quotes_gpc on, which isn’t recommended for security reasons, and it is even removed in later versions of PHP.