diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py
index cc961e268a54f8e0dcac0d7ce8515928e66dfe24..8d07f32d373d00e1a5b42bad112de5b6d3211eb5 100755
--- a/indra/lib/python/indra/util/llmanifest.py
+++ b/indra/lib/python/indra/util/llmanifest.py
@@ -575,13 +575,13 @@ def replace_in(self, src, dst=None, searchdict={}):
         if dst == None:
             dst = src
         # read src
-        f = open(self.src_path_of(src), "rbU")
+        f = open(self.src_path_of(src), "rU")
         contents = f.read()
         f.close()
         # apply dict replacements
-        for old, new in searchdict.iteritems():
+        for old, new in searchdict.items():
             contents = contents.replace(old, new)
-        self.put_in_file(contents, dst)
+        self.put_in_file(contents.encode("utf-8"), dst)
         self.created_paths.append(dst)
 
     def copy_action(self, src, dst):
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index db0210bf4280c4ed414320dc016c24f288cd8573..126b8a8c69bc0eeb5f201fcb4571f8f522304db2 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -272,7 +272,7 @@ def icon_path(self):
 
     def extract_names(self,src):
         try:
-            contrib_file = open(src,'r')
+            contrib_file = open(src,'rU')
         except IOError:
             print("Failed to open '%s'" % src)
             raise
@@ -291,7 +291,7 @@ def extract_names(self,src):
                 names.append(line.rstrip())
         # It's not fair to always put the same people at the head of the list
         random.shuffle(names)
-        return ', '.join(names)
+        return ', '.join(names).encode("utf-8")
 
     def relsymlinkf(self, src, dst=None, catch=True):
         """
@@ -658,8 +658,7 @@ def wpath(path):
         result = ""
         dest_files = [pair[1] for pair in self.file_list if pair[0] and os.path.isfile(pair[1])]
         # sort deepest hierarchy first
-        dest_files.sort(lambda a,b: cmp(a.count(os.path.sep),b.count(os.path.sep)) or cmp(a,b))
-        dest_files.reverse()
+        dest_files.sort(key=lambda path: (path.count(os.path.sep), path), reverse=True)
         out_path = None
         for pkg_file in dest_files:
             rel_file = os.path.normpath(pkg_file.replace(self.get_dst_prefix()+os.path.sep,''))
@@ -682,8 +681,7 @@ def wpath(path):
             for d in deleted_file_dirs:
                 deleted_dirs.extend(path_ancestors(d))
             # sort deepest hierarchy first
-            deleted_dirs.sort(lambda a,b: cmp(a.count(os.path.sep),b.count(os.path.sep)) or cmp(a,b))
-            deleted_dirs.reverse()
+            deleted_dirs.sort(key=lambda path: (path.count(os.path.sep), path), reverse=True)
             prev = None
             for d in deleted_dirs:
                 if d != prev:   # skip duplicates