phpes Posted February 9, 2008 Share Posted February 9, 2008 Hi everyone, I have a script and have a problem. Web links doesn't support turkish character. When i use turkish character in thread, links don't work. Because link contains turkish characters. So i must change these characters. For example: to "ç" with "c". Please help me. This is original code: <?php $result = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' ORDER BY 'ID' DESC LIMIT 0,5"); $x = 0; while ($row = mysql_fetch_assoc($result)) { $x += 1; $Recent_Wallpapers .= "\n".'<div class="Box Left"'.$string.'>'."\n\t"; $Recent_Wallpapers .= '<div style="font-size: 1em; margin-bottom: 5px;"><a href="'.$image_path.'wallpaper/'.str_replace(" ", "-", $row['Title']).'/">'.$row['Title']."</a></div>"; $Recent_Wallpapers .= '<a href="'.$image_path.'wallpaper/'.str_replace(" ", "-", $row['Title']).'/"><img class="Thumbnail" src="'.$image_path.'images/wallpapers/'.$row['Thumbnail'].'" alt="'.$row['Title'].'" /></a>'; $Recent_Wallpapers .= '</div>'; if (!is_int($x/3)){ $Recent_Wallpapers .= '<div class="Spacer"> </div>'; } } $Recent_Wallpapers .= '<div class="Clear"></div>'; echo $Recent_Wallpapers; ?> And i have tried this code but didn't work. Link didn't change with english character: <?php $result = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' ORDER BY 'ID' DESC LIMIT 0,5"); $x = 0; while ($row = mysql_fetch_assoc($result)) { $tr = array('ğ','ü','ş','ı','ö','ç','İ','Ğ','Ü','Ş','Ö','Ç'); $en = array('g','u','s','i','o','c','i','G','U','S','O','C'); $row['Title'] = str_replace($tr,$en,$row['Title']); $x += 1; $Recent_Wallpapers .= "\n".'<div class="Box Left"'.$string.'>'."\n\t"; $Recent_Wallpapers .= '<div style="font-size: 1em; margin-bottom: 5px;"><a href="'.$image_path.'wallpaper/'.str_replace(" ", "-", $row['Title']).'/">'.$row['Title']."</a></div>"; $Recent_Wallpapers .= '<a href="'.$image_path.'wallpaper/'.str_replace(" ", "-", $row['Title']).'/"><img class="Thumbnail" src="'.$image_path.'images/wallpapers/'.$row['Thumbnail'].'" alt="'.$row['Title'].'" /></a>'; $Recent_Wallpapers .= '</div>'; if (!is_int($x/3)){ $Recent_Wallpapers .= '<div class="Spacer"> </div>'; } } $Recent_Wallpapers .= '<div class="Clear"></div>'; echo $Recent_Wallpapers; ?> How can i fix this problem? Thanks.. Quote Link to comment https://forums.phpfreaks.com/topic/90281-link-character-problem/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.