minor refactoring

This commit is contained in:
Miroslav Stampar
2011-04-29 15:22:32 +00:00
parent a2bb0d72e8
commit 6bb4dce3aa
4 changed files with 24 additions and 24 deletions

View File

@@ -1799,22 +1799,6 @@ def getUnicode(value, encoding=None, system=False):
except:
return getUnicode(value, UNICODE_ENCODING)
def encodeUnicode(value, encoding=None):
"""
Return 8-bit string representation of the supplied unicode value:
>>> encodeUnicode(u'test')
'test'
"""
retVal = value
if isinstance(value, unicode):
try:
retVal = value.encode(encoding or UNICODE_ENCODING)
except UnicodeEncodeError:
retVal = value.encode(UNICODE_ENCODING, errors="replace")
return retVal
# http://boredzo.org/blog/archives/2007-01-06/longest-common-prefix-in-python-2
def longestCommonPrefix(*sequences):
if len(sequences) == 1: