def ResolveObject(self, path): opath = path if not isinstance(path, bytes): path = path.encode(self.chm_encoding) ans = CHMFile.ResolveObject(self, path) if ans[0] != chmlib.CHM_RESOLVE_SUCCESS and not isinstance(opath, bytes): path = opath.encode('utf-8') ans = CHMFile.ResolveObject(self, path) return ans
def _get_contents(self, path): """return html contents of file `path' in chm archive.""" obj = CHMFile.ResolveObject(self, path) if obj[0] != 0: return None html = CHMFile.RetrieveObject(self, obj[1]) return html[1]
def ResolveObject(self, path): # filenames are utf-8 encoded in the chm index as far as I can # determine, see https://tika.apache.org/1.11/api/org/apache/tika/parser/chm/accessor/ChmPmgiHeader.html if not isinstance(path, bytes): path = path.encode('utf-8') return CHMFile.ResolveObject(self, path)