--- 0.10/p4trac/p4trac.py	2006-03-27 06:07:52.000000000 -0800
+++ ../../perforceplugin/0.10/p4trac/p4trac.py	2006-05-18 14:41:35.000000000 -0700
@@ -52,7 +52,7 @@
         cmd = path + '#head'
     else:
         cmd = path + '@' + rev
-    return cmd
+    return cmd.encode('ascii', 'ignore')
 
 
 
@@ -122,7 +122,7 @@
             _count = int(self.__class__.history[-1]) - int(rev) + 1
             _idx = len(self.__class__.history)
 
-        changes = self.__class__.p4c.run("changes", "-m", str(_count), "-s", "submitted", _strRev)
+        changes = self.__class__.p4c.run("changes", "-m", str(_count), "-s", "submitted", _strRev.encode('ascii','ignore'))
         #self.log.debug("*** _complete history %s %s %s %s" % (rev, _count, _idx, changes))
         for change in changes:
             num = change['change']
@@ -165,10 +165,10 @@
         try:
             _deb = time.time()
             if rev != None:
-                change = self.__class__.p4c.run_describe( "-s", str(rev))[0]
+                change = self.__class__.p4c.run_describe( "-s", str(rev).encode('ascii','ignore'))[0]
             else:
                 young = self.get_youngest_rev()
-                change = self.__class__.p4c.run_describe("-s", str(young))[0]
+                change = self.__class__.p4c.run_describe("-s", str(young).encode('ascii','ignore'))[0]
             self.log.debug("*** get_changeset (%f)   %s" % (time.time() - _deb, rev))
         except self.__class__.p4c.P4Error:
             for e in p4.errors:
@@ -210,7 +210,7 @@
                 dir = self.__class__.p4c.run("dirs", path2)
             else:
                 #path = "\"" + path + "\""
-                dir = self.__class__.p4c.run("dirs", path)
+                dir = self.__class__.p4c.run("dirs", path.encode('ascii', 'ignore'))
             self.log.debug("*** get_node (%f)  path = '%s' rev = %s" % (time.time() - _deb, path, rev))
 
             if len(dir) != 0:
@@ -369,24 +369,24 @@
         if self.isfile:
             _my_path = _add_rev_to_path(_normalize_path(path), rev)
             _deb = time.time()
-            self.stat = self.p4c.run("fstat", _my_path)
+            self.stat = self.p4c.run("fstat", _my_path.encode('ascii','ignore'))
             self.log.debug("*** PerforceNode __init__ (%f)  %s" % (time.time() - _deb, _my_path))
             if self.stat[0]['headAction'] == 'delete':
                 raise TracError, "No node at %s in revision %s" % (path, rev)
             self.content = None
-            self.info = self.p4c.run("files", path)[0]
+            self.info = self.p4c.run("files", path.encode('ascii', 'ignore'))[0]
 
 
     def _get_content(self):
         _my_path = _add_rev_to_path(self.path, self.rev)
         _deb = time.time()
         if self.stat[0]['headType'].startswith('binary') == True or self.stat[0]['headType'].startswith('ubinary') == True:
-            file = self.p4c.run("print", "-o", TmpFileName, _my_path)
+            file = self.p4c.run("print", "-o", TmpFileName, _my_path.encode('ascii','ignore'))
             f = open(TmpFileName, 'rb')
             self.content = f.read()
             f.close()
         else:
-            file = self.p4c.run("print", _my_path)
+            file = self.p4c.run("print", _my_path.encode('ascii','ignore'))
             del file[0]
             sep = '\n'
             self.content = sep.join(file)
@@ -421,18 +421,18 @@
 
         _deb = time.time()
 
-        dirs = self.p4c.run("dirs", path)
+        dirs = self.p4c.run("dirs", path.encode('ascii', 'ignore'))
         #self.log.debug("---    dirs = '%s'" % (dirs))
 
         for dir in dirs:
             mydir = _add_rev_to_path(dir['dir'] + "...", self.rev)
-            changes = self.p4c.run("changes", "-m 1 -status submitted", mydir)
+            changes = self.p4c.run("changes", "-m 1 -status submitted", mydir.encode('ascii','ignore'))
             maxrev = str(changes[0]["change"])
 
             yield PerforceNode(dir['dir'], maxrev, self.p4c, self.log, Node.DIRECTORY)
 
         if self.path != '//':
-            files = self.p4c.run("files", path)
+            files = self.p4c.run("files", path.encode('ascii', 'ignore'))
             for file in files:
                 #self.log.debug("found file '%s'" % (file['depotFile']))
                 change = self.p4c.run("fstat", _add_rev_to_path(file['depotFile'], self.rev))[0]
@@ -457,7 +457,7 @@
         cmd = _add_rev_to_path(_normalize_path(self.path), self.rev)
         self.log.debug("*** get_history = %s  %s" % (cmd, limit))
         if self.isfile:
-            logs = self.p4c.run("filelog", "-m", str(limit), "-i", cmd)
+            logs = self.p4c.run("filelog", "-m", str(limit), "-i", cmd.encode('ascii','ignore'))
             #self.log.debug("*** get_history logs %s" % (logs))
             idx = 0
             path = self.path
@@ -493,7 +493,7 @@
             #self.log.debug("*** get_history entries %s" % (histories))
         else:
             #self.log.debug("*** get_history 1 logs %s %s" % (self.path, cmd))
-            logs = self.p4c.run("changes", "-s", "submitted", "-L", "-m", str(limit), cmd)
+            logs = self.p4c.run("changes", "-s", "submitted", "-L", "-m", str(limit), cmd.encode('ascii','ignore'))
             #self.log.debug("*** get_history 2 logs %s %s %s" % (self.path, logs, cmd))
             _index = 0
             for myLog in logs:
@@ -519,7 +519,8 @@
         if self.isdir:
             return None
         _deb = time.time()
-        type = self.p4c.run("fstat", "-Ol", self.path)
+        #type = self.p4c.run("fstat", "-Ol", self.path.encode('ascii', 'ignore'))
+        type = self.p4c.run("fstat", "-l", self.path.encode('ascii', 'ignore'))
         #self.log.debug("*** get_content_length (%f)" % (time.time() - _deb))
         if type[0]['headAction'].startswith('delete') == True:
             return 0
@@ -532,7 +533,7 @@
         if self.isdir:
             return None
         _deb = time.time()
-        change = self.p4c.run("fstat", self.path)[0]
+        change = self.p4c.run("fstat", self.path.encode('ascii','ignore'))[0]
         #self.log.debug("*** get_content_type (%f)" % (time.time() - _deb))
         if change['headType'].startswith('binary') == True or change['headType'].startswith('ubinary') == True:
             return 'application/octet-stream'
@@ -594,12 +595,12 @@
                 changes.append([file, Node.FILE, action, file, self.rev])
                 deletions[file] = index
             elif action == 'integrate':
-                filelog = self.p4c.run("filelog", "-m", "1", _add_rev_to_path(file, self.rev))
+                filelog = self.p4c.run("filelog", "-m", "1", _add_rev_to_path(file, self.rev).encode('ascii','ignore'))
                 #self.log.debug("*** get_changes integrate %s %s" % (file, filelog))
                 action = Changeset.COPY
                 changes.append([file, Node.FILE, action, filelog[0]['file'][0][0], rev])
             elif action == 'branch':
-                filelog = self.p4c.run("filelog", "-m", "1", _add_rev_to_path(file, self.rev))
+                filelog = self.p4c.run("filelog", "-m", "1", _add_rev_to_path(file, self.rev).encode('ascii','ignore'))
                 #self.log.debug("*** get_changes branch %s %s" % (file, filelog))
                 action = Changeset.COPY
                 _base_path = filelog[0]['file'][0][0]
