<?php
## Converting utf8 characters to iso-88591 manually in PHP
echo "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />";
function str_replace_char(){
$find = array('“', '’', '…', 'â€"', 'â€"', '‘', 'é', 'Â', '•', 'Ëœ', 'â€'); // en dash
$replace = array('"', '’', '…', '—', '–', '‘', 'é', '', '•', '˜', '"'); // original
$new_str_content = str_replace( $find,$replace,$str_content);
return $new_str_content;
}
$string = "It’s Getting the Best of Me";
echo $new_string = str_replace_char($string);
?>
## Converting utf8 characters to iso-88591 manually in PHP
echo "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />";
function str_replace_char(){
$find = array('“', '’', '…', 'â€"', 'â€"', '‘', 'é', 'Â', '•', 'Ëœ', 'â€'); // en dash
$replace = array('"', '’', '…', '—', '–', '‘', 'é', '', '•', '˜', '"'); // original
$new_str_content = str_replace( $find,$replace,$str_content);
return $new_str_content;
}
$string = "It’s Getting the Best of Me";
echo $new_string = str_replace_char($string);
?>
No comments:
Post a Comment