And then run an application with DB_URL=ecto://postgres:mypwdWith#Symbol/some_db
I get Ecto.InvalidURLError invalid url ..., path should be a database name error.
I checked source code and saw, that this URL string parses using url |> URI.decode() |> URI.parse()
I tried it and saw that after # symbol everything parses as a url fragment. I encoded this symbol to %23 and tried. But received the same result, because it decodes before parses.
Looks like I can’t use # symbol in a DB password, Am I missing something?
You can use # symbol in your database password, but if you’re using URL as your connection string, that character separates the URL itself from fragment id, see https://en.wikipedia.org/wiki/Fragment_identifier
edit: Sorry if the above is obvious, I’m not sure whether that’s a bug or feature
URI’s have rules of which characters are allowed where and any not allowed ones need to be encoded. The userinfo section requires ? to be percent encoded: