question about coding
Unanswered
Black-whiskered Vireo posted this in #help-forum
Black-whiskered VireoOP
I code query parameter 'Alfa Romeo'
I get aaa=Alfa%2520Romeo
is it ok?
I get aaa=Alfa%2520Romeo
if(a) {
console.log(a.label);
let a_val = encodeURIComponent(a.label);
query_params.set("a", a_val);
};is it ok?
5 Replies
American Crow
it's just url encoding / decoding you can double check using online tools .e.g
https://meyerweb.com/eric/tools/dencoder/
However Alfa Romeo is encoded
Having
https://meyerweb.com/eric/tools/dencoder/
However Alfa Romeo is encoded
Alfa%20RomeoHaving
Alfa%2520Romeo you most likely accidentally encoded twiceBlack-whiskered VireoOP
OK Thanks
@Black-whiskered Vireo I code query parameter 'Alfa Romeo'
I get aaa=Alfa%2520Romeo
if(a) {
console.log(a.label);
let a_val = encodeURIComponent(a.label);
query_params.set("a", a_val);
};
is it ok?
this code is wrong, it is encoding the string twice
Alfa Romeo
Alfa%20Romeo (space becomes %20)
Alfa%2520Romeo (% becomes %25)
just
Alfa Romeo
Alfa%20Romeo (space becomes %20)
Alfa%2520Romeo (% becomes %25)
just
query_params.set("a", a.label) should already be good.Black-whiskered VireoOP
What bundler does Angular use?
v18