In PostgreSQL URL I can't use a password containing special characters
You have to use URI escapes for all problematic characters.

For this user:

CREATE ROLE "weird@name" PASSWORD '\/ @&amp;?' LOGIN;


You can login like this:

psql postgresql://weird%40name:%5C%2F%20%40%26%3F@localhost:5432/test


The documentation has it:


  Percent-encoding may be used to include symbols with special meaning in any of the URI parts, e.g. replace = with %3D.