TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 05-26-2009, 11:43 AM   #1 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default Special to plain characters

Hey guys,

I've been working on a project for the last couple of months and now I bumped into a problem I've been putting off.

I've got the word 'Agapé', with the nice small comma on the e. For short, a special character. Now I need to change this to the word 'agape' without loosing anything.

strtolower works perfect, but I'm stuck the with the special character. How do I change it to it's 'parent', the letter e?
__________________
"Life is a bitch, take that bitch on a ride"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
Old 05-26-2009, 01:13 PM   #2 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Just use normal string functions to replace some characters (eg. àéîøü) with their equivalent ones (eg. aeiou).
Salathe is offline  
Reply With Quote
Old 05-26-2009, 02:20 PM   #3 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default

Well, simple enough. I'll give it a go. Thanks mate.
__________________
"Life is a bitch, take that bitch on a ride"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
Old 05-27-2009, 10:33 AM   #4 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default

I found and edited a function that does some of the work for me, either I wonder if I matched all the currently, most commonly used characters. Have a look;

PHP Code:
function tidyString($string){    
    
    
$string strtr($string"ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ""SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy");    
    
$string preg_replace('#\b\%\d.(|\b)#u'''$string);    
    
$string preg_replace('#\b\%\d.(|\b)#u''+'$string);    
    
$string preg_replace('#\b\+\++(|\b)#u''+'$string);
    
    return 
$string;


__________________
"Life is a bitch, take that bitch on a ride"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting special characters in LIKE (mySQL) ReSpawN Advanced PHP Programming 2 11-12-2012 07:44 AM
Unexpected characters in output Killswitch Absolute Beginners 2 12-20-2008 04:29 AM
Cleaning out unwanted characters Andrew General 6 10-20-2007 08:31 PM


All times are GMT. The time now is 06:11 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design