toblesu
07-04-2008, 15:29
Boas...
Tenho valores guardados numa BD e quanto tento extrair palavras com acentuação ou cedilhadas, é colocado um caracter "estranho" no lugar....
já tentei usar a seguinte função:
function getRewriteString($sString) {
$string = strtolower(htmlentities($sString));
$string = preg_replace("/&(.)(uml);/", "$1e", $string);
$string = preg_replace("/&(.)(acute|cedil|circ|ring|tilde|uml);/", "$1", $string);
$string = preg_replace("/([^a-z0-9]+)/", "-", html_entity_decode($string));
$string = trim($string, "-");
return $string;
}
mas não corre la muito bem... por e simplesmente não me escreve a palavra!
alguma sugestão??
obrigado!
Tenho valores guardados numa BD e quanto tento extrair palavras com acentuação ou cedilhadas, é colocado um caracter "estranho" no lugar....
já tentei usar a seguinte função:
function getRewriteString($sString) {
$string = strtolower(htmlentities($sString));
$string = preg_replace("/&(.)(uml);/", "$1e", $string);
$string = preg_replace("/&(.)(acute|cedil|circ|ring|tilde|uml);/", "$1", $string);
$string = preg_replace("/([^a-z0-9]+)/", "-", html_entity_decode($string));
$string = trim($string, "-");
return $string;
}
mas não corre la muito bem... por e simplesmente não me escreve a palavra!
alguma sugestão??
obrigado!