2
$\begingroup$

I have a .srt file (subtitle file) with the following text:

Chapitre 1 : Systèmes d'équations linéaires et matrices

However when I import it into Mathematica, using:

subRip = ReadList[subRibFile, String];

I get:

Chapitre 1 : Systèmes d'équations linéaires et matrices

How can I avoid that ?

$\endgroup$
2
  • $\begingroup$ What do you get if you do Import[ subRibFile, "Text"]? $\endgroup$
    – Jason B.
    Oct 7, 2018 at 11:10
  • $\begingroup$ @JasonB. Thanks for your comment. In that case, I get one string which is not seperated by lines... but the output is correctly decoded. :) $\endgroup$
    – james
    Oct 7, 2018 at 11:51

1 Answer 1

2
$\begingroup$

This is a bit of a workaround, using "import" but it works !

subRipIm = Import[subRibFile, "Text", CharacterEncoding -> "UTF8"];
subRip = DeleteCases[StringSplit[ToString[subRipIm], "\n"], ""];
$\endgroup$
1
  • $\begingroup$ Thanks a lot ! This works ! :) $\endgroup$
    – james
    Oct 7, 2018 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.