https://www.google.com/
https://www.google.com/
What is the different between above two links. And how can i convert Ist link to 2nd link using javascript or regex. Please help and give a expert advice.
CodePudding user response:
decodeURIComponent('https://www.google.com/')
URL encoding converts characters into a format that can be transmitted over the Internet.
URLs can only be sent over the Internet using the ASCII character-set.
Since URLs often contain characters outside the ASCII set, the URL has to be converted into a valid ASCII format.
URL encoding replaces unsafe ASCII characters with a "%" followed by two hexadecimal digits. URLs cannot contain spaces. URL encoding normally replaces a space with a plus ( ) sign or with .
CodePudding user response:
I can help with the first question: There's no difference between the two links. One is encoded using UTF-8 codes instead of the symbols. You can verify this by converting the URL in a URL Encoder/Decoder. Somebody else will have to help with the conversion using JS or regex.