bbcompent1
bbcompent1

Reputation: 494

Convert characters to decoded html then back to encoded on submitted to page

I have special characters like # & and so on. What was suggested is I html decode these characters before passing them to my PHP image generator (a font previewer like things remembered).

I have no issues turning the text into html decoded, but how do I turn them back to encoded on the page the text gets submitted to?

Upvotes: 1

Views: 83

Answers (1)

Dorad
Dorad

Reputation: 3713

The PHP superglobals $_GET and $_POST should be automatically decoded if you send a properly encoded data from the client side, I.E. using encodeURIcomponent() js function.

If it doesn't seem to be decoded for some reason, you should find out why (maybe you double-encoded it?), or bypass it like with urldecode() php func (there is also a workaround for utf8 decoding).

Upvotes: 1

Related Questions