import re


def sanitizeFilename(path):
    """Sanitize filename so that it only contains alphanumeric characters, dots and underscores.
    
    In particular:
     - Replace spaces and dashes with underscores.    
     - Replace all german umlauts (in UTF-8 encoding) with their ASCII transliterations.
     - Erase everything else (e.g. braces, commas etc).
    """
    # German umlauts.
    r = path.replace("a\xcc\x88", "ae")
    r = path.replace("o\xcc\x88", "oe")
    r = path.replace("u\xcc\x88", "ue")
    r = path.replace("A\xcc\x88", "Ae")
    r = path.replace("O\xcc\x88", "Oe")
    r = path.replace("U\xcc\x88", "Ue")
    r = path.replace("\xc3\x9f", "ss")
    
    # Spaces and dashes.
    r = r.replace(" - ", "_")
    r = r.replace(" ", "_")
    r = r.replace("-", "_")
    
    # Erase everything else.
    r = re.sub("[^0-9a-zA-Z._/]", "", r)
    return r