OK, I'm resolving this with a bit of a cheat...
I'll just prepend a set of legitimate, non-error-generating letters to the beginning of the code.
So, instead of the code being
50rtTB2vEIdd20UgD4Puk2tcjBuQsdY9Q
which will cause problems when put in the URL like,
http://127.0.0.1:51042/confirm?code=50rtTB2vEIdd20UgD4Puk2tcjBuQsdY9Q
which becomes
http://127.0.0.1:51042/confirm?codePrtTB2vEIdd20UgD4Puk2tcjBuQsdY9Q
in the user's email, I will just prepend valid characters like this:
http://127.0.0.1:51042/confirm?code=XYZ50rtTB2vEIdd20UgD4Puk2tcjBuQsdY9Q
Solved! (?) ?