1
I have a service where I make a request of type GET that does a search in the groups of my application, the problem is that the user created a group called #nome-do-grupo
, and when he goes to do the name search and he puts the hash, the error search because there is no way to send the hash to the server request.
I tried to use the encodeURIComponent
but the search did not happen, I started to do a regex to remove the hashs from the string, but I would have to predict the maximum of other broken characters that it can put so it was sent.
If anyone has been through this, as you do in this case ?
When you use
encodeURIComponent
, the string is escaped as%23nome-do-grupo
? Maybe it’s the case that Code is missing on the server side?– Marcus Vinicius
And then I used the
encodeURIComponent
and it wasn’t rolling because there was another script that was taking the term and giving anotherescape
it then was getting %2523name-of-the-group, I took thisescape
and it worked as you described, then I had other problems with the other characters and I did it hereencodeURIComponent(str).replace(/[!'()]/g, escape).replace(/\*/g, '')
ai worked properly.– fbadaro