From bf89b8e9a928812baedc830a20afeae6b04eaefe Mon Sep 17 00:00:00 2001 From: calvin Date: Fri, 18 Feb 2005 11:29:58 +0000 Subject: [PATCH] str() for unicode_safe objects git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2324 e7d03fd6-7b0d-0410-9947-9c21f3af8025 --- linkcheck/strformat.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linkcheck/strformat.py b/linkcheck/strformat.py index 4497ecce..8bc1ac76 100644 --- a/linkcheck/strformat.py +++ b/linkcheck/strformat.py @@ -33,16 +33,16 @@ def unicode_safe (s, encoding="iso-8859-1"): characters of the given encoding will be ignored. @param s: the string to be decoded - @type s: unicode or encoded string + @type s: any object except None @return: if s is already unicode, return s unchanged; else return - decoded unicode string + decoded unicode string of str(s) @rtype: unicode """ assert s is not None, "argument to unicode_safe was None" if isinstance(s, unicode): # s is already unicode, nothing to do return s - return unicode(s, encoding, "ignore") + return unicode(str(s), encoding, "ignore") def url_unicode_split (url):