note 75566 added to function.str-replace
| From: | tim at hysniu dot com | Date: | Tue, 05 Jun 2007 18:27:00 +0000 |
| Subject: | note 75566 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127238@lists.php.net to get a copy of this message | ||
I found that having UTF-8 strings in as argument didnt
work for me using heavyraptors function.
Adding UTF-8 as argument on htmlentities
fixed the problem.
cheers, tim at hysniu.com
<?php
function replace_accents($str) {
$str = htmlentities($str, ENT_COMPAT, "UTF-8");
$str = preg_replace(
'/&([a-zA-Z])(uml|acute|grave|circ|tilde);/',
'$1',$str);
return html_entity_decode($str);
}
?>
----
Server IP: 66.207.199.35
Probable Submitter: 209.52.149.157
----
Manual Page -- http://www.php.net/manual/en/function.str-replace.php
Edit -- https://master.php.net/note/edit/75566
Del: integrated -- https://master.php.net/note/delete/75566/integrated
Del: useless -- https://master.php.net/note/delete/75566/useless
Del: bad code -- https://master.php.net/note/delete/75566/bad+code
Del: spam -- https://master.php.net/note/delete/75566/spam
Del: non-english -- https://master.php.net/note/delete/75566/non-english
Del: in docs -- https://master.php.net/note/delete/75566/in+docs
Del: other reasons-- https://master.php.net/note/delete/75566
Reject -- https://master.php.net/note/reject/75566
Search -- https://master.php.net/manage/user-notes.php