0

I save a web page edited by users in our app backend

in js : encodeURIComponent returns this

%3C!--%20saved%20from%20url%3D(0077)https%3A%2F%2Fwww.w3schools.com%2Fw3css%2Ftryw3css_templates_gourmet_catering.htm%23about

in php : urldecode returns this

<!-- saved from url=(0077)https:\/\/www.w3schools.com\/w3css\/tryw3css_templates_gourmet_catering.htm#about 

so far so good....

now, when I fetch the data from the db and reencode it in php urlencode returns this :

%3C%21--+saved+from+url%3D%280077%29https%3A%2F%2Fwww.w3schools.com%2Fw3css%2Ftryw3css_templates_gourmet_catering.htm%23about

so it ends up in JS beeing decoded with + all over the place :

<!--+saved+from+url=(0077)https://www.w3schools.com/w3css/tryw3css_templates_gourmet_catering.htm#about

1 - yes I could just replace the + but I feel I am doing something wrong

2 - why does encodeurl do that if it is not compatible with js decodeURIcomponent ?

regards

user7082181
  • 354
  • 3
  • 15

0 Answers0