1

I have below HTML form...If I put characters like ! or ^ or £ in the password text box, my server gets different characters including %...How it is possible to get "exactly" same characters for password in my server...

if I entered password as abc!£^hg^! , my server gets password as abc%21%C2%A3%5Ehg%5E%21

   <form autocomplete="off" method="POST" accept-charset="utf-8">
        <div>
            <label>Name:</label>
            <input type="text" name="name"/>
        </div>
        <div>
            <label>Password:</label>
            <input type="password" name="password"/>
        </div>
        <div>
            <input type="submit" value="Login"/>
        </div>
    </form>

1 Answers1

3

Form data has to be encoded somehow for transmission over HTTP.

URL encoding is the default for forms. In that format, some characters are encoded using percent encoding.

You need to solve this by using server-side code that handles the encoded form data properly, not by trying to hack things so the data isn't encoded.

Any language you might use for server-side programming will have libraries (or built-in approaches) for solving this.

Take, for example, this question about reading form data when the server-side code is written in JavaScript and uses the Express.js framework. It uses the urlencoded middleware from the body-parse module to decode the data.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335