From eed3ff80e00b4b4fd0f0c7d5758ba5638f3bc7fe Mon Sep 17 00:00:00 2001 From: Josip Pisoj Date: Mon, 8 Mar 2010 18:12:13 +0000 Subject: [PATCH] bug #3662: SoundEx works only for ascii characters svn: r14700 --- src/soundex.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/soundex.py b/src/soundex.py index c9c00d35f..19ee3f988 100644 --- a/src/soundex.py +++ b/src/soundex.py @@ -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')