Skip to content

'+' in query part of urls #482

@ulf5

Description

@ulf5

Hello!

When parsing an url that contains + in the query part of the url, I would've expected it to be percent encoded. As it seems to be the behaviour of all the websites I have found, to decode plus to space that is. Why is this not the case? I did read the discussion of #416, but I'm afraid I didn't really understand the answer in it. Are the web services, i.e. google etc, not following the standard by decoding plus to space?

fn main() {
    use url::Url;
    println!("{}", Url::parse("http://google.com/?q=rust+url github").expect("").as_str());
}

Will print this url: http://google.com/?q=rust+url%20github and if you visit the link then "rust url github" will be the query entered into the google search box.
To clarify what I'm asking, why is the + in the above url not be encoded as %2B?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions