Convert special characters in string to %HH code

Hello,

I am trying to generate urls to access an API and I need to replace special characters with their equivalent %HH code that is readable by the httr::GET() function.

I would like to convert this string:

https://geocoder.ls.hereapi.com/search/6.2/geocode.xml?languages=en-US&maxresults=4&searchtext=Galerie%20Anc.%20Hôtel%20des%20Postes,1000%20&apiKey=sVJ3-TbDbG1bbQciCjet_is3eybkZb0bvJjWxgHI1F0

to this string:

https://geocoder.ls.hereapi.com/search/6.2/geocode.xml?languages=en-US&maxresults=4&searchtext=Galerie%20Anc.%20H%C3%83%C2%B4tel%20des%20Postes,1000%20&apiKey=sVJ3-TbDbG1bbQciCjet_is3eybkZb0bvJjWxgHI1F0

as you can see the "ô" got converted to %C3%83%C2%B4 and this string works as an argument to the httr::GET() function.

Thank you,