How to convert this string manipulation function UTF-8 Compatible in PHP?

Zoossygen

New Member
I had trouble finding a function that does exactly what I am looking for. Unfortunatly, this function isn't UTF-8 compatible. This functions is like a basic \[code\]ucwords\[/code\] but it also does the uppercase on a character followed by one of the given characters found (in my case I need to apply an uppercase on the character found after a \[code\]-\[/code\]).Here is the function:\[code\]<?phpfunction my_ucwords($string) { $noletters='"([/-'; //add more if u need to for($i=0; $i<strlen($noletters); $i++) $string = str_replace($noletters[$i], $noletters[$i].' ', $string); $string=ucwords($string); for($i=0; $i<strlen($noletters); $i++) $string = str_replace($noletters[$i].' ', $noletters[$i], $string); return $string; }$title = 'ELVIS "THE KING" PRESLEY - (LET ME BE YOUR) TEDDY BEAR';echo my_ucwords(strtolower($title));?>\[/code\]As soon as I add accents to my string, e.g.:\[code\]echo my_ucwords(strtolower( "saint-
 
Back
Top