Change string encoding function from escape to encodeURIComponent

Change string encoding function from escape to encodeURIComponent.
Because the encode function could not multibyte string for URI.