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$
  • $\begingroup$ What do you get if you do Import[ subRibFile, "Text"]? $\endgroup$ – Jason B. Oct 7 '18 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 '18 at 11:51
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$
  • $\begingroup$ Thanks a lot ! This works ! :) $\endgroup$ – james Oct 7 '18 at 11:52

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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