Return to Snippet

Revision: 12551
at March 18, 2009 16:11 by fackz


Initial Code
<?php
function fullUpper($str){
   // convert to entities
   $subject = htmlentities($str,ENT_QUOTES);
   $pattern = '/&([a-z])(uml|acute|circ';
   $pattern.= '|tilde|ring|elig|grave|slash|horn|cedil|th);/e';
   $replace = "'&'.strtoupper('\\1').'\\2'.';'";
   $result = preg_replace($pattern, $replace, $subject);
   // convert from entities back to characters
   $htmltable = get_html_translation_table(HTML_ENTITIES);
   foreach($htmltable as $key => $value) {
      $result = ereg_replace(addslashes($value),$key,$result);
   }
   return(strtoupper($result));
}

echo fullUpper("try this: äöüß");
?>

Initial URL


Initial Description
ISO-8859-1 (Latin 1) full with all special characters:
results in

TRY THIS: ÄÖÜß

Initial Title
Uppercasing with special characters

Initial Tags


Initial Language
PHP