def escapeName(name):
    """Escape a name such that it is safe to use for files and anchors."""
    escape = '_'
    xs = []
    for c in name:
        if c.isalpha() or c in ['-']:
            xs.append(c)
        else:
            xs += [escape, str(ord(c))]
    return ''.join(xs)