0

My problem is simple, every time I try to pass a string with special characters, through a $http.get() query, some special characters are removed.

In my case, a simple email: [email protected], become emmawatson.com in the query header.

Is Angular doing some sort of validation before sending AJAX query ?

Here is my Ajax code:

$http.get(apiUrl,
            {
                params: {
                    username: "Emma",
                    email: "[email protected]",
                    password: "1234"
                }
            })
            .success(function(data) {
                //do a simple return of the email on the server
                console.log(data);//"emmawatson.com"
            });

1 Answer 1

1

For http requests, it's strongly recommended to base64 encode your data before sending it.

Try this code and see if it works:

$http.get(apiUrl, {
    params: {
        username: "Emma",
        email: window.btoa("[email protected]"),
        password: "1234"
    }
})
.success(function (data) {
    //do a simple return of the email on the server
    console.log(data); //"emmawatson.com"
});
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot, this solve my problem with a decode on the server side :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.