Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRLF & LF #12

Open
labmem005 opened this issue Apr 9, 2019 · 4 comments
Open

CRLF & LF #12

labmem005 opened this issue Apr 9, 2019 · 4 comments

Comments

@labmem005
Copy link

A file write with 'CRLF' can't parse.
SubtitleParsingException: Unable to parse cue number: 1

@clebeaupin
Copy link
Contributor

Could you provide an sample file containing CRLF ?

@labmem005
Copy link
Author

crlf.srt.zip

@missesProper
Copy link

Hi together :-) I do have the same problem - f.i. with the attached srt.
src.zip
Reason is probably the BOM.
Proposal: When doing

// First textLine is the cue number try { Integer.parseInt(textLine); } catch (NumberFormatException e) { throw new SubtitleParsingException(String.format( "Unable to parse cue number: %s", textLine)); }

Use this method to fix textLine:
private static String removeUTF8BOM(String s) { if (s != null && s.startsWith(UTF8_BOM)) { s = s.substring(1); } return s; }

with
private static final String UTF8_BOM = "\uFEFF";

Sorry if this is not the proper way to contribute, it is my first day at Github - and it is FRIDAY!

@labmem005
Copy link
Author

@missesProper Thank you!get it ^O^/

:octocat: From gitme Android

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants