>> $ psql "postgres://localhost:5432/postgres?application_name=a b"> psql: error: trailing data found: "a b">
This works fine for me, and sets a space in the application_name string asexpected. Do you have a different example?
Cheers,Greg