Esempio n. 1
0
def name_ascii(name,ext=''):
  spechars = '"',"'",'-','#','&','|',' ','.',',','!',':',';','%','£','$','*','(',')','[',']','{','}','=','+','^','§','°','`','@','?','/', '\xc2\xa0'
  for sp in spechars: name = name.replace(sp,'_')
  name = unac.unac_string(name)
  name = re.sub(r'([_])\1+', r'\1', name) # remove repeting
  name = re.sub(r'^([_])+', '', name) # remove starting
  if name[-1]=='_': name = name[:-1]
  return (name+ext).lower()
Esempio n. 2
0
File: vsutils.py Progetto: vrx/vspy
def name_ascii(name, ext=""):
    spechars = (
        '"',
        "'",
        "-",
        "#",
        "&",
        "|",
        " ",
        ".",
        ",",
        "!",
        ":",
        ";",
        "%",
        "£",
        "$",
        "*",
        "(",
        ")",
        "[",
        "]",
        "{",
        "}",
        "=",
        "+",
        "^",
        "§",
        "°",
        "`",
        "@",
        "?",
        "/",
        "\xc2\xa0",
    )
    for sp in spechars:
        name = name.replace(sp, "_")
    name = unac.unac_string(name)
    name = re.sub(r"([_])\1+", r"\1", name)  # remove repeting
    name = re.sub(r"^([_])+", "", name)  # remove starting
    if name[-1] == "_":
        name = name[:-1]
    return (name + ext).lower()
Esempio n. 3
0
def remove_accents(s):
    #return unicodedata.normalize('NFKD',u).encode('ascii','ignore')
    return unac.unac_string(s)