I'm trying to create some clean URLs for artist names. I'm using the following to parse Pearl Jam to pearl-jam. All is fine until it tries to process KoЯn. Instead of returning korn, it is returning koand1071n. In my database, KoЯn is actually stored as
KoЯn
I'm using this code below. What can I do to handle the backwards R?
$delimiter = "-";
$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $str);
$clean = str_replace("\$", "s", $clean);
$clean = preg_replace( '/&/', 'and', $clean );
$clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean);
$clean = strtolower(trim($clean, '-'));
$clean = preg_replace("/[\/_|+ -]+/", $delimiter, $clean);
$clean = strtolower(trim($clean, '-'));
Just replace Я with a r with str_replace like you do for $
$clean = str_replace("Я", "r", $clean);
or
$clean = str_replace("Я", "r", $clean);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With