Anyone else having similar issues, make sure to encode any special characters you might have on the password.
When using a password in a connection string (e.g., for PostgreSQL), certain characters must be URL-encoded to ensure the connection string is valid and can be parsed correctly. Here’s a list of characters that should be encoded, along with their encoded values:
Character | Encoded Value | Reason for Encoding |
---|---|---|
: |
%3A |
Used to separate the username and password in the connection string. |
/ |
%2F |
Used as a path separator in URLs. |
? |
%3F |
Marks the beginning of query parameters in URLs. |
@ |
%40 |
Separates the credentials (username:password) from the host in the connection string. |
= |
%3D |
Used in query parameters to separate keys and values. |
& |
%26 |
Used to separate multiple query parameters. |
' |
%27 |
Can interfere with string parsing in some environments. |
" |
%22 |
Can interfere with string parsing in some environments. |
(space) |
%20 or + |
Spaces are not allowed in URLs. |
# |
%23 |
Marks the beginning of a fragment in URLs. |
% |
%25 |
Used as the escape character in URL encoding. |
+ |
%2B |
Can be interpreted as a space in some contexts. |
; |
%3B |
Can interfere with parsing in some environments. |
, |
%2C |
Can interfere with parsing in some environments. |
If your password is:
pass'word@123:/#?=&
The encoded version would be:
pass%27word%40123%3A%2F%23%3F%3D%26