encodeURIcomponent() issue with single quote

Javascript encodeURIComponent doesn’t encode single quotes, is there any alternate fix for this.

The JavaScript encode method does so in order to make the text safe as a url.

For what other purpose are you encoding the text? There is likely to be a different and better solution for your needs.

my issue is i have a share component by clicking on the social media icon i need to fetch the browser title and page URL in text area. In browser title itself have single quotation mark, though i have used ASCII codes in chrome and IE in social media window showing � like this, my assumption we can fix it trough javascript encodeURIcomponent() function, i am not sure about my assumption.

did you try encodeURI() instead (which encodes more characters than encodeURIComponent() does)

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.