Skip to content

Instantly share code, notes, and snippets.

@heartbleeded
Forked from J2TEAM/remove_accents.py
Created March 18, 2020 18:15
Show Gist options
  • Select an option

  • Save heartbleeded/1ec6d57f3a2a6a96ec016b60fa61e6b5 to your computer and use it in GitHub Desktop.

Select an option

Save heartbleeded/1ec6d57f3a2a6a96ec016b60fa61e6b5 to your computer and use it in GitHub Desktop.

Revisions

  1. @cinoss cinoss created this gist Apr 6, 2016.
    11 changes: 11 additions & 0 deletions remove_accents.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    s1 = u'ÀÁÂÃÈÉÊÌÍÒÓÔÕÙÚÝàáâãèéêìíòóôõùúýĂăĐđĨĩŨũƠơƯưẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐốỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹ'
    s0 = u'AAAAEEEIIOOOOUUYaaaaeeeiioooouuyAaDdIiUuOoUuAaAaAaAaAaAaAaAaAaAaAaAaEeEeEeEeEeEeEeEeIiIiOoOoOoOoOoOoOoOoOoOoOoOoUuUuUuUuUuUuUuYyYyYyYy'
    def remove_accents(input_str):
    s = ''
    print input_str.encode('utf-8')
    for c in input_str:
    if c in s1:
    s += s0[s1.index(c)]
    else:
    s += c
    return s