After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 657017 - Detect newline types on open and force on save
Detect newline types on open and force on save
Status: RESOLVED OBSOLETE
Product: gnome-subtitles
Classification: Other
Component: general
1.1
Other Linux
: Normal normal
: ---
Assigned To: Maintainers of GNOME subtitles
Maintainers of GNOME subtitles
Depends on:
Blocks:
 
 
Reported: 2011-08-21 17:02 UTC by Clemente Aguiar
Modified: 2018-09-21 16:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gnome-subtitle preferences (30.28 KB, image/png)
2011-08-22 12:26 UTC, Clemente Aguiar
Details

Description Clemente Aguiar 2011-08-21 17:02:49 UTC
I set the preferences to save in "Windows" format, i.e. with CRLF end of line, but the files are saved as Linux format (LF only).

$ file subtitles.srt: "ISO-8859 text
Comment 1 Pedro Castro 2011-08-21 20:32:39 UTC
Hi,

Can you post the output of running Gnome Subtitles from a terminal? I've just tested this and wasn't able to reproduce that behavior:
$ file SubtitlesISOLinux.srt 
SubtitlesISOLinux.srt: ISO-8859 text
$ file SubtitlesISOMac.srt 
SubtitlesISOMac.srt: ISO-8859 text, with CR line terminators
$ file SubtitlesISOWindows.srt 
SubtitlesISOWindows.srt: ISO-8859 text, with CRLF line terminators

Also, if you run gedit and do a find for \r or \n, does it detect these chars?
Comment 2 Clemente Aguiar 2011-08-22 12:26:07 UTC
Created attachment 194356 [details]
gnome-subtitle preferences
Comment 3 Clemente Aguiar 2011-08-22 12:33:40 UTC
I had a PT subtitle file.

$ file subtitles.srt 
subtitles.srt: ISO-8859 text, with CRLF line terminators

I opened it with gnome-subtitles and saved it.

$ gnome-subtitles subtitles.srt
Got 29 languages.
Detected encodings: windows-1252
Trying the encoding Windows-1252
Trying to autodetect the subtitle format.
[*] opened /home/clemente/DVDs/subtitles.srt with encoding I18N.West.CP1252 and format SubRip
[*] Saved Text /home/clemente/DVDs/subtitles.srt with encoding I18N.West.CP1252 and format SubRip

File was save without the CRLF.

$ file subtitles.srt 
subtitles.srt: ISO-8859 text

I attached the gnome-subtitles settings window.

If you require any further info, please let me know.
Comment 4 Clemente Aguiar 2011-08-22 12:36:36 UTC
Also, after saving the file with gnome-subtitles, I opened the file with gedit, when I search for \r find nothing, when I search for \n, it finds one at the end of every line.
Comment 5 Pedro Castro 2011-08-22 18:05:18 UTC
Obrigado pela info! :-)

Here's the problem, that option in the preferences is for the Save As dialog only, it isn't used when you save a file without going through that dialog. Perhaps this should be stated more clearly in the Preferences dialog.

Now, Gnome Subtitles should detect which line endings are used in a file it opens, and continue to use those line endings. Currently it isn't detecting anything so it just saves with "\n" when you don't go through the Save As dialog.

Besides that, do you actually need an option to force the newline type used, no mater what the original file had?
Comment 6 Clemente Aguiar 2011-08-22 18:44:18 UTC
Ok, understood.

What I found out is that my DVD player (Philips), as well as one of my friends DVD player (Samsung or something like that) does not work with the Linux newline type (\n), but really requires the Windows type format (CR). I supposed that a lot of DVD players are like that.

So yes, it would be nice if one could configure a) to keep the original file newline type or b) force the newline type.
Comment 7 GNOME Infrastructure Team 2018-09-21 16:14:01 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-subtitles/issues/76.