I am creating a new event in google calendar by the following URL structure.
https://calendar.google.com/calendar/r/eventedit?
text=discount for Asgardian&
dates=20200327T032400Z/20200327T032400Z&
details=Thor will be there to receive you&
location=Asgard&
trp=false&sprop=&sprop=name:
here is a URL variable text , which represents the title of an event.
if I pass a plain string, it works well. but if I pass special character like '%' (eg 20% off for Asgardian ), then google calendar gave me -
Bad Request
Error 400
how can I pass '%'?
(same error for details vaiable also)
in the comment, @terry gave me answer for how to pass %
through URL. I need to encode it as %25
.
he also share that - Javascript has a built-in function for this URL encoding. encodeURIComponent()
if we wrap our string by encodeURIComponent()
, it'll give us URL encoded string.
thanks.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.