Answer the question
In order to leave comments, you need to log in
How to get Cyrillic from RTF file using python or linux?
Good evening, I'm trying to extract Russian text from an rtf file, I'm trying to execute the unrtf utility from the console
def rtf_file_to_text(path: str) -> str:
"""
Возвращает текст из rtf документа
"""
cmd = ['unrtf', path]
p = Popen(cmd, stdout=PIPE)
stdout, stderr = p.communicate()
text = stdout.decode('utf-8')
return text
<b><font face="Times New Roman"><font size="4">Обоснование начальной (максимальной) цены </font></font></b>контракта
Answer the question
In order to leave comments, you need to log in
I found a solution to this question, I think this is one of the normal solutions in my case. Installed libreoffice on the server using
import os
os.system('lowriter --headless --convert-to txt file.rtf")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question