Fixes #915 - stop interpreting the tilde character

(cherry picked from commit 6dcbde18969623b3ab4ee985c19dcbeb0d48e3d4)