bug #3662: SoundEx works only for ascii characters

svn: r14700
This commit is contained in:
Josip Pisoj 2010-03-08 18:12:13 +00:00
parent 6d4838add9
commit eed3ff80e0

View File

@ -28,6 +28,7 @@ Provide soundex calculation
#
#-------------------------------------------------------------------------
import string
import unicodedata
#-------------------------------------------------------------------------
#
@ -46,7 +47,8 @@ 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')