Svedr
Svedr

Reputation: 589

Converting UTF characters but only if

Ok, so i've found a font on typekit i really really like and suits the design very well.

Unfortunately this font lacks the character "Č" but has "Ž,Š". What i am trying to do is that if there is a Č in the title, i want the Č to be converted to a C that the font can normally display. So Č->C.

This is the code i've put together now, but now it converts all the characters.

<?php 
$title_converted = iconv('UTF-8', 'ASCII//TRANSLIT', $title);
echo '<h1 id="intro-title" ' . $team_name_class_full . '>' . iconv('UTF-8', 'windows-1252', $title_converted) . '</h1>';

Could you help me out futher please.

Thank you

Upvotes: 0

Views: 74

Answers (1)

Snowstormer
Snowstormer

Reputation: 248

You can just use plain old str_replace to do this.

$title_converted = str_replace("Č", "C", $title);

Upvotes: 4

Related Questions