Why are [] characters processed this way in my URL?

1

When I send a $_GET of my application I have the following expression tipo%5B%5D=CASA in my url . The data comes from an HTML element of type checkbox of name="tipo[]" .

These characters simply represent [ and ] .

Does anyone know why this is happening and how to solve this?

<input type="checkbox" name="tipo[]" value="APARTAMENTO/APTO DUPLEX" id="tp1">
<label for="tp1">Apartamento</label>

<input type="checkbox" name="tipo[]" value="CASA" id="tp2">
<label for="tp2">Casa</label>

<input type="checkbox" name="tipo[]" value="CASA EM CONDOMINIO" id="tp3">
<label for="tp3">Casa Condomínio</label>
    
asked by anonymous 01.11.2014 / 22:31

1 answer

3

There's nothing wrong with this string. This is a way to encode characters to be transmitted securely (with a code that does not allow mistakes).

So:

  

% 5B is' [% 5D is'] '% 20 / p>

If you want to get this back to a string in javascript you can use this:

decodeURI('tipo%5B%5D=CASA')
// resultado: "tipo[]=CASA"

var codificado = 'tipo%5B%5D=CASA';
var descodificado = decodeURI(codificado);
alert(descodificado);
    
01.11.2014 / 22:50