text = self.text.split() try: for index in xrange(len(text)): word = text[index] if not self.isEngSource: word = word.decode('utf-8') output.insert( index, self.engine.transform(word).encode('utf-8')) else: if not Vida.is_ascii(word): word = word.decode('utf-8') if not self.usdictionary.check( word) and not self.gbdictionary.check(word): output.insert( index, self.engine.transform(word).encode('utf-8')) else: output.insert(index, word) status = True message = "Succesfully transliterated the code." except UnicodeDecodeError, e: Repo.exception(e) message = "Couldn't decode the language properly." except IndexError, e: Repo.exception(e) message = "Couldn't properly frame the sentence." output = ' '.join(output) output = output.decode('utf-8') content['output'] = output return Repo.api('libraries:vida#run', status, message, content)