Urlencode in Rust?


#1

In Python, with the built-in urllib, I could simply encode URL parameter:

    >>> import urllib
    >>> f = { 'eventName' : 'myEvent', 'eventDescription' : 'cool event'}
    >>> urllib.urlencode(f)
   'eventName=myEvent&eventDescription=cool+event'

Is there something similar with urllib in rust-std, I have googled before, but I found nothing :frowning:


#2

https://docs.rs/url/1.6.0/url/form_urlencoded/index.html


#3

Took me a bit to find this example: https://play.rust-lang.org/?gist=89b090004cf3f649460456d7e53a66c4&version=stable


#4

https://rust-lang-nursery.github.io/rust-cookbook/encoding.html#encode-a-string-as-applicationx-www-form-urlencoded Encoding and decoding example from the cookbook


#5

thanks for your reply, I have solved my problem with you guys’ help