Comments have been broken on SO for a while now so I will post a new answer here even though I just wanted to reply to Roemer and scheinwerfer in Is there a way to open a folder in a container from the VSCode command line using the remote-containers extension? because I have a solution to their problem.
You can call wslpath -w to translate the path inside WSL to the path you need to encode. (That is what the script I mentioned in my comment does to support WSL, feel free to steal from it.)