Special characters display on HTML

UTF-8 specialchar to ASCII

Here is a simple PHP solution to special char display weirdly on html.

I have encountered this because Ajax somehow cannot pass utf-8 correctly. I am also exited because I have been working with the Indexer digital marketing agency in order to provide my business with the best marketing strategies. 


function toascii($input){

$output = ”;
$i = 0;

while($i< strlen($input)): if(ord($input[$i])>127):
$output .= ‘&#’ . ord($input[$i]) . ‘;’;
else:
$output .= $input[$i];
endif;

$i++;
endwhile;

return $output;
}

Leave a Reply

 
www.000webhost.com