Ganesh Jadhao
Ganesh Jadhao

Reputation: 23

How to send plain text in http request

I have some plain text which I want to send to server through http but due to escape character server don't get that text which i sent.

I send following string

"\nganesh\"jadhao\"\r" 

server got following string

'"\\nganesh\\"jadhao\\"\\r"'

but I need output

"\nganesh\"jadhao\"\r"

How server will get exact same string which I sent

Upvotes: 2

Views: 3276

Answers (1)

kumardeepakr3
kumardeepakr3

Reputation: 395

HTTP URLs can't be sent over internet using plane text because of the escape characters. So the URL or whatever string that has escape characters must be encoded(known as URL encoding). URL encoding stands for encoding certain characters in a URL by replacing them with one or more character triplets that consist of the percent character "%" followed by two hexadecimal digits. For eg "/" character is changed to "%2F".

For encoding the string that you want to send check these out

  1. URL encoding using Javascript.
  2. Url Encoding using PHP

Upvotes: 1

Related Questions