I sent a text via GET method to decode html entities ( w = w )
> ?text=w&type=htmldecode&format=text
I got errors in the $text variable then I tried to set it in the last of the link
?format=text&type=htmldecode&text=w
and I got the same errors
how I can fix that ?
There are 2 types of encoding pertinent to your problem. HTML escape characters, and URL escape chars.
When you have a character in an HTML page, you use the HTML escape characters. eg
w = wBut you cannot use those characters in a URL –
&and#have special meanings in URLs. So you have to encode again – this time using URL escape characters.# = %23& = %26; = %3BSo your string, (‘w’) fit to be put into a URL, would be:
%23%26119%3Band your entire query string:
?text=%23%26119%3B&type=htmldecode&format=textthe aforementioned PHP urlencode() does this.
The snippet:
outputs
%26%23119%3B