How to disconnect a line?

using the ajax get method to pass the variable. where I use to escape the line with the escape () function.

In php, I get the value and paste it into the database.

How to disconnect a line?

For example, for:

balaji's

I get

balaji%27s.
+3
source share
4 answers

You can use this function instead of urldecode ()

function utf8_urldecode($str) {
        return html_entity_decode(preg_replace("/%u([0-9a-f]{3,4})/i", "&#x\\1;", urldecode($str)), null, 'UTF-8');
}
+8
source

Use what i did with this

htmlspecialchars (urldecode ($ string))

+8
source

escape encodeURIComponent. escape URI. ( - , , .) encodeURIComponent URI. PHP , , :

var word = "balaji's";
$.ajax({
    url: "yoururl",
    data: encodeURIComponent("word") + "=" + encodeURIComponent(word)
});

If you do not send data in the default multipart form (for example, you override dataType), you will have to decode it yourself through . urldecode

+4
source

Consider the functions of PHP, urldecode () or rawurldecode () .

One difference, apparently, is the processing of the + signs (plus).

You must be sure to check the lines containing the plus signs to ensure that you have selected the correct function.

+1
source

All Articles