With an error on my site, in% of UTF-8
If I use á
it will pro link as %E3%83%E2%A1
and printa in input as %e3%83%e2%a1
in hosting.
But in localhost it goes as ã¡
and returns as %c3%a3%c2%a1
.
The codes I'm using are these:
To display the Code:
function mostrar($string) {
$string = str_replace('+', ' ', $string);
$string = utf8_decode($string);
return mb_strtolower( strip_tags( trim( $string ) ) );
}
To Send Code:
function limpar($string) {
$string = str_replace(' ', '+', $string);
$string = utf8_encode($string);
return mb_strtolower( strip_tags( trim( str_replace('/', '', $string) ) ) );
}
Sending header('Location')
to appear on the site url:
if(isset($_POST['procm-p']) or isset($_POST['procm-s'])){
$pesquisa = strip_tags($_POST['procm-s']);
if(isset($pesquisa) and !empty($pesquisa)){
$link = $surl.'p/'.limpar($pesquisa);
header("Location: ".$link);
}else{
echo '<script>alert("Pesquisa Invalida");</script>';
}
}
Printing in the input:
<input type="text" name="procm-s" value="<?php echo mostrar( $url[1] ); ?>" placeholder="Procurar Musicas" />
How is the form:
<div id="pesquisa2">
<form action="" enctype="multipart/form-data" autocomplete="on" method="post" name="procm">
<input type="text" name="procm-s" value="<?php echo mostrar($url[1]); ?>" placeholder="Procurar Musicas" />
<input type="submit" value="Procurar" name="procm-p" id="btn" />
</form>
</div>
I placed the site on the air so that you can see: link
What I wanted was for it to be like utf-8 encoded
and come back as utf-8
normal, but that does not happen.
And if you notice as I said above, it has an immense difference between my localhost
and my hospedagem
.
Do you know what it can be? I am using utf8_encode()
and utf8_decode()
and even header('Content-Type: text/html; charset=utf-8');
.