Switch from the deprecated escape() to encodeURIComponent()