I have this web app with a search form: https://bookyst.herokuapp.com/ . Users can search for books by their titles, authors or isbn. The application returns all books that much the search string. However, this works only when the search is done before the application is fully loaded and the url is encoded with + . Thereafter, any search returns a url encoded with %20 and no results. I don't know why and how. You can see this issue if you run the application: https://bookyst.herokuapp.com/
Asked
Active
Viewed 45 times
0
-
https://en.wikipedia.org/wiki/Percent-encoding#The_application/x-www-form-urlencoded_type – Bergi May 14 '20 at 20:01
-
@Bergi, if you try out the web app in questions: for instance searching for 'THe Dark Is Rising', this url https://bookyst.herokuapp.com/?keyword=The+Dark+Is+Rising works. However, searching after the app is fully loaded: you will get this: https://bookyst.herokuapp.com/?keyword=The%20Dark%20Is%20Rising which does not return any result. So I am wondering, how can I make sure that the url is encoded with +all the time instead of %20 ? – Tito Yak May 14 '20 at 20:22
-
Why does it matter? Anything that's decoding the URL should treat them both equivalently. – Barmar May 14 '20 at 20:31
-
@TitoYak Add `.replace(/%20/g,'+')` to the part of the code that does the encoding. – Bergi May 14 '20 at 20:39