Aneildo 0 Denunciar post Postado Fevereiro 16, 2009 eu axei uma função na net para limpar texto para url, mas qnd eu vo usá tá dando os seguintes erros Warning: preg_replace() [function.preg-replace]: Compilation failed: invalid UTF-8 string at offset 3 in C:\xampp\htdocs\nti\test.php on line 4 Warning: preg_replace() [function.preg-replace]: Compilation failed: invalid UTF-8 string at offset 3 in C:\xampp\htdocs\nti\test.php on line 5 Warning: preg_replace() [function.preg-replace]: Compilation failed: invalid UTF-8 string at offset 3 in C:\xampp\htdocs\nti\test.php on line 6 Warning: preg_replace() [function.preg-replace]: Compilation failed: invalid UTF-8 string at offset 3 in C:\xampp\htdocs\nti\test.php on line 7 Warning: preg_replace() [function.preg-replace]: Compilation failed: invalid UTF-8 string at offset 2 in C:\xampp\htdocs\nti\test.php on line 8 Warning: preg_replace() [function.preg-replace]: Compilation failed: invalid UTF-8 string at offset 2 in C:\xampp\htdocs\nti\test.php on line 9 Warning: preg_replace() [function.preg-replace]: Compilation failed: invalid UTF-8 string at offset 1 in C:\xampp\htdocs\nti\test.php on line 10 <?php function clean($texto) { $texto = html_entity_decode($texto); $texto = preg_replace('![aáàãâä]+!u','a',$texto); $texto = preg_replace('![eéèêë]+!u','e',$texto); $texto = preg_replace('![iíìîï]+!u','i',$texto); $texto = preg_replace('![oóòõôö]+!u','o',$texto); $texto = preg_replace('![uúùûü]+!u','u',$texto); $texto = preg_replace('![ç]+!u','c',$texto); $texto = preg_replace('![ñ]+!u','n',$texto); $texto = eregi_replace('( )','-',$texto); $texto = preg_replace('![^a-z0-9\-]+!u','',$texto); $texto = eregi_replace('--','-',$texto); return strtolower($texto); } $a = clean('çãó4'); echo $a; ?> se alguém poder me ajudar eu agradeço muito Compartilhar este post Link para o post Compartilhar em outros sites
Renato Siroma 2 Denunciar post Postado Fevereiro 16, 2009 Tire os 'u' da E.R. EX: $texto = preg_replace('![aáàãâä]+!','a',$texto); $texto = preg_replace('![eéèêë]+!','e',$texto); $texto = preg_replace('![iíìîï]+!','i',$texto); $texto = preg_replace('![oóòõôö]+!','o',$texto); $texto = preg_replace('![uúùûü]+!','u',$texto); $texto = preg_replace('![ç]+!','c',$texto); $texto = preg_replace('![ñ]+!','n',$texto); $texto = eregi_replace('( )','-',$texto); $texto = preg_replace('![^a-z0-9\-]+!','',$texto); $texto = eregi_replace('--','-',$texto); Compartilhar este post Link para o post Compartilhar em outros sites
Aneildo 0 Denunciar post Postado Fevereiro 16, 2009 Tire os 'u' da E.R. EX: $texto = preg_replace('![aáàãâä]+!','a',$texto); $texto = preg_replace('![eéèêë]+!','e',$texto); $texto = preg_replace('![iíìîï]+!','i',$texto); $texto = preg_replace('![oóòõôö]+!','o',$texto); $texto = preg_replace('![uúùûü]+!','u',$texto); $texto = preg_replace('![ç]+!','c',$texto); $texto = preg_replace('![ñ]+!','n',$texto); $texto = eregi_replace('( )','-',$texto); $texto = preg_replace('![^a-z0-9\-]+!','',$texto); $texto = eregi_replace('--','-',$texto); Renato Siroma, obrigado pela a ajudar Compartilhar este post Link para o post Compartilhar em outros sites
Mário Monteiro 179 Denunciar post Postado Setembro 20, 2009 lucasmartins.com.br Este tópico é antigo como pode observar na data, seu post foi excluído. Crie um novo tópico para postar sua dúvida. Compartilhar este post Link para o post Compartilhar em outros sites