I vaguely suspected urlencoding might work. But I wasn't about to test it unless I had a motivation to do so
manually typing things (without bash filename completion) gets increasingly awkward without copy-paste and on a small touchscreen.
So, good of you to find out for us.
For however useful it is to ensure pre-existing, stable filenames embedded in a script can be embedded with spaces in them.
...
Also, it is probably both more efficient and more portable to do it all in awk:
https://gist.github.com/moyashi/4063894