import string


def convert_special_chars_to_ascii(func_name):
    """
    Convert non-alphanumeric characters to their ascii representation.

    This is how Haddock generates links for operators.

    '!?' => '-33--63-'
    """

    if func_name == None:
        return None

    escaped_func_name = [ c if c not in string.punctuation else '-' + str(ord(c)) + '-'
                          for c in func_name ]

    return ''.join(escaped_func_name)