. ======================================================================*/ // TODO: should perhaps remove overlong encoded utf8, but hopefully // the next user in line ignores the overlong utf8 like it should. function kjwstring_safe_line($single_line) { return preg_replace("/[\x01-\x1f]/", '', str_replace("\t", ' ', str_replace("\x00", '', $single_line))); } function kjwstring_remove_western_accents($string) { static $a = array( 'À','Á','Â','Ã','Ä','Å','Æ', 'Ç','È','É','Ê','Ë','Ì','Í','Î','Ï', 'Ñ','Ò','Ó','Ô','Õ','Ö','Ø','Ù','Ú','Û','Ü','Ý','Ÿ','Y', 'ß','à','á','â','ã','ä','å','æ', 'ç','è','é','ê','ë','ì','í','î','ï', 'ñ','ò','ó','ô','õ','ö','ø','ù','ú','û','ü','ý','ÿ', 'Š','Œ','Ž','š','œ','ž' ); static $b = array( 'A','A','A','A','A','AA','AE', 'C','E','E','E','E','I','I','I','I', 'n','O','O','O','O','O','OE','U','U','U','U','Y','Y','Y', 'ss','a','a','a','a','a','aa','ae', 'c','e','e','e','e','i','i','i','i', 'n','o','o','o','o','o','oe','u','u','u','u','y','y', 'S','OE','Z','s','oe','z' ); return str_replace($a, $b, $string); } function kjwstring_urlify($string) { return trim(preg_replace('![^A-Za-z0-9-]+!', '_', kjwstring_remove_western_accents($string) ), '_'); } ?>