Ben Parker wrote: > The notes in urlDecode indicate it will raise this type of exception, > but I don't see why it needs to. Any reason why urlDecode should not > handle that exception and treat "%" like any other character if the two > characters following it are not valid hexadecimal?
I agree that it would be better to silently ignore such invalid codes, and the same is done by urllib.unquote_plus() also. I also noticed that since Python 2.4, unquote_plus() treats codes with only one digit as invalid and ignores them (i.e. "% a" or "%a " will not be converted to chr(10) any more; I think this is better). So I modified urlDecode to behave exactly like urllib.unquote_plus() in Python 2.4. urlEncode() already does the same as urllib.quote_plus(). Since Python 2.4, using urlEncode() and urlDecode() makes no big sense any more, since urllib does the same now double as fast (in practice, they are equally fast because encoded chars occur only very rarely). -- Christoph _______________________________________________ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss