Switch to side-by-side view

--- a/OSSEval/OpenSourceProject/utils.py
+++ b/OSSEval/OpenSourceProject/utils.py
@@ -14,6 +14,7 @@
 from xml.dom import minidom
 import urllib2
 import OpenSourceProject
+import base64
 
 class Configuration():
     api_key = OpenSourceProject.ohloh_api_key
@@ -65,3 +66,43 @@
                 print('Error downloading ' + url_string + " - Attempt n.:" + str(n_attempts) + " - " + str(ex))
                 n_attempts = n_attempts + 1
         return ret
+
+class StringList():
+    separator = " "
+    
+    def __init__(self):
+        self.plain = []
+        self.base64_encoded = ""
+        
+    def load_plain(self, strings):
+        self.plain = strings
+        separator = ""
+        for s in self.plain:
+            self.base64_encoded += separator + base64.b64encode(s)
+            separator = StringList.separator
+        return self
+
+    def load_base64(self, base64_encoded):
+        self.base64_encoded = base64_encoded
+        for s in self.base64_encoded.split(StringList.separator):
+            self.plain.append(base64.b64decode(s))
+        return self
+
+    def remove_empty_strings(self):
+        # self.load_plain(filter(lambda text: text.strip(), self.plain))
+        self.load_plain([text for text in self.plain if text.strip()])
+
+class StringHelper():
+    @staticmethod
+    def removeNonAscii(thisString): 
+        return "".join(filter(lambda x: ord(x)<128, thisString))
+    @staticmethod
+    def makeUnicodeSafe(thisString):
+        '''
+        It is probably equivalent to the above method
+        '''
+        while True:
+            try:
+                return unicode(thisString)
+            except UnicodeDecodeError as ex: #UnicodeDecodeError
+                thisString = thisString[0:ex.start] + thisString[ex.end:]