please use encodeURIComponent/decodeURIComponent instead of encodeURI/decodeURI in the JS file.
use Convertor::getEncodedStr to get the string that could be decoded by decodeURIComponent function. use Convertor::getRawString to get the string which is encoded by encodeURIComponent function in JS.