createrepo/utils.py

[email protected] (Seth Vidal)
Newsgroups gmane.linux.rpm.metadata
Message-ID <[email protected]>
 createrepo/utils.py |   35 -----------------------------------
 1 file changed, 35 deletions(-)

New commits:
commit b02a068c130dd051c3ce3f9545b7eb64fe0f83af
Author: Seth Vidal <[email protected]>
Date:   Mon Sep 15 16:43:56 2008 -0400

    remove unused utf8String function from utils - move most of it into yum.misc

diff --git a/createrepo/utils.py b/createrepo/utils.py
index 3dd349b..1b0d015 100644
--- a/createrepo/utils.py
+++ b/createrepo/utils.py
@@ -73,41 +73,6 @@ def returnFD(filename):
         raise MDError, "Error opening file"
     return fdno
 
-def utf8String(string):
-    """hands back a unicoded string"""
-    if string is None:
-        return ''
-    elif isinstance(string, unicode):    
-        return string
-    du = False
-    try:
-        x = unicode(string, 'ascii')
-        du = True
-    except UnicodeError:
-        encodings = ['utf-8', 'iso-8859-1', 'iso-8859-15', 'iso-8859-2']
-        for enc in encodings:
-            try:
-                x = unicode(string, enc)
-            except UnicodeError:
-                pass
-            else:
-                if x.encode(enc) == string:
-                    return x.encode('utf-8')
-    newstring = ''
-    # Kill bytes (or libxml will die) not in the small byte portion of:
-    #  http://www.w3.org/TR/REC-xml/#NT-Char
-    # we allow high bytes, if it passed the utf8 check above. Eg.
-    # good chars = #x9 | #xA | #xD | [#x20-...]
-    bad_small_bytes = range(0, 8) + [11, 12] + range(14, 32)
-    for char in string:
-        if ord(char) in bad_small_bytes:
-            pass # Just ignore these bytes...
-        elif not du and ord(char) > 127:
-            newstring = newstring + '?'
-        else:
-            newstring = newstring + char
-    return newstring
-
 def checkAndMakeDir(dir):
     """
      check out the dir and make it, if possible, return 1 if done, else return 0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.