- 
      
- 
        Save mezklador/e53cf1ecbd79d76f45bd96dbb917c273 to your computer and use it in GitHub Desktop. 
    PHP: Convert Accented Characters
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /* | |
| For instance, if you want to use a string as part of a URL but | |
| need to make it safe for that kind of use. | |
| */ | |
| function replace_accents($str) { | |
| $str = htmlentities($str, ENT_COMPAT, "UTF-8"); | |
| $str = preg_replace('/&([a-zA-Z])(uml|acute|grave|circ|tilde);/','$1',$str); | |
| return html_entity_decode($str); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment