diff --git a/include/class.file.php b/include/class.file.php
index 364e7f14ac570d3cc0c2bb2fa074bb05eef1c29a..da8ad76dc0ed9e9917596829fa7a6450f8176b2d 100644
--- a/include/class.file.php
+++ b/include/class.file.php
@@ -181,7 +181,7 @@ class AttachmentFile {
         $sql='INSERT INTO '.FILE_TABLE.' SET created=NOW() '
             .',type='.db_input($file['type'])
             .',size='.db_input($file['size'])
-            .',name='.db_input($file['name'])
+            .',name='.db_input(Format::file_name($file['name']))
             .',hash='.db_input($file['hash']);
 
         if (!(db_query($sql) && ($id=db_insert_id())))
diff --git a/include/class.format.php b/include/class.format.php
index aaa6667d32c2fce14da2cb9f5e15387ec9608b0c..b510221e02b41a8da8b4bfd27278cfdb9e5d5e9d 100644
--- a/include/class.format.php
+++ b/include/class.format.php
@@ -31,10 +31,7 @@ class Format {
     }
 
     function file_name($filename) {
-
-        $search = array('/ß/','/ä/','/Ä/','/ö/','/Ö/','/ü/','/Ü/','([^[:alnum:]._])');
-        $replace = array('ss','ae','Ae','oe','Oe','ue','Ue','_');
-        return preg_replace($search,$replace,$filename);
+        return preg_replace('/\s+/', '_', $filename);
     }
 
     /* re-arrange $_FILES array for the sane */