diff --git a/src/soundex.py b/src/soundex.py index c9c00d35f..753db1b44 100644 --- a/src/soundex.py +++ b/src/soundex.py @@ -28,6 +28,7 @@ Provide soundex calculation # #------------------------------------------------------------------------- import string +import unicodedata #------------------------------------------------------------------------- # @@ -45,11 +46,11 @@ TABLE = string.maketrans('ABCDEFGIJKLMNOPQRSTUVXYZ', #------------------------------------------------------------------------- def soundex(strval): "Return the soundex value to a string argument." - - strval = strval.upper().strip() + + strval = unicodedata.normalize('NFKD', + strval.upper().strip()).encode('ASCII', 'ignore') if not strval: return "Z000" - strval = strval.encode('iso-8859-1') str2 = strval[0] strval = strval.translate(TABLE, IGNORE) if not strval: