|
|
#1 |
|
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Jul 2026
Device: Kobo Glo
|
LF or CRLF line ending?
I'm new to the Sigil ePUB editor and tried it out today (v2.8.1 on Windows), and noticed that when saving, in was converting the line endings from LF to CRLF.
Is this the norm for this application? Is it not supposed to be using only LF (Unix style) for proper EPUB conformity? I did run a search on the forum first with the keywords “CRLF” and “CRLF ending” and “LF ending” but did not seem to find any relevant posts about the issue. |
|
|
|
|
|
#2 | |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,841
Karma: 7500000
Join Date: Nov 2009
Device: many
|
The epub spec properly allows and accepts both cr/lf and just lf as will any xhtml or html document where both are considered whitespace and therefore condensed to one. So both are supported by the epub, xhtml, and html specs.
When reading from Windows, Sigil will strip off crlf to just linefeeds for editing in Qt/Sigil's Codeview, and when saving to a file on Windows Sigil puts them back since open-with and other text editors want crlf on Windows. So whoever said lf only for epub was mistaken. The whatwg living html spec and xhtml parsers all handle both cases properly. Quote:
Last edited by KevinH; 07-29-2026 at 03:33 PM. |
|
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Jul 2026
Device: Kobo Glo
|
Alright, but then why is Sigil forcing an existing LF file into CRLF if it is less space efficient?
Is this only a Windows version issue? Should it not be standardised independently of the platform, or maybe have a user setting to define which format to use? PS! All of the editors I have used on Windows have had no issues with working with LF (unix style) files, and have even preserved the format when resaving them. So I don't think it mandatory for the Windows version of Sigil to force CRLF. |
|
|
|
|
|
#4 | |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,841
Karma: 7500000
Join Date: Nov 2009
Device: many
|
To save space? Huh?
Windows still standardizes on crlf for text. It may now allow others but the native format is crlf. And yes this is something that only happens on Windows. Neither MacOS nor any Unix based alternative needs CRLF. This has been happening with Sigil on Windows for over 15 years and no one has complained once. Quote:
Let's see what if anything other longterm users of Sigil on Windows say about this. If they too want this behaviour to change, I will add that is a future version of Sigil. Last edited by KevinH; 07-29-2026 at 03:48 PM. |
|
|
|
|
|
|
#5 |
|
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 53,432
Karma: 181843001
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
A topic on which I am totally neutral.
I have worked on ePubs where both line endings were used and saw no difference in the behaviour when they were opened for reading. At one time, I unzipped the files for 11 ePub/kepubs and used NotePad++ to change the EOL and then re-zipped them. Since ePub files are stored in a zip container, the file size difference was negligible. On my Kobo readers using both renderers, I could see no changes in displayed text or behaviour. A quote from Macbeth comes to mind: "full of sound and fury, signifying nothing." |
|
|
|
| Advert | |
|
|
|
|
#6 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29,625
Karma: 212299010
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I work with epubs in Sigil on Linux and Windows and I can't think of a single time Sigil's behavior RE line endings ever affected me (or crossed my mind for that matter).
|
|
|
|
|
|
#7 | |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,841
Karma: 7500000
Join Date: Nov 2009
Device: many
|
And for what it is worth, Sigil uses Qt's QTextStream for writing out files and it has the following default behaviour:
Quote:
And it is the default for writing text in python3 on Windows as well. So both Qt and python3 both do this by default for text file writing on Windows. Sigil seems to be in good company. Last edited by KevinH; 07-29-2026 at 04:21 PM. |
|
|
|
|
|
|
#8 |
|
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 53,432
Karma: 181843001
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
The only reason I even thought about it was that one author whom I did some work for after their book rights had reverted to them had been told that ePubs needed to have LF only as the EOL. After a couple of hours of testing, research and too much coffee, the conclusion was that either could be used. Epubcheck, Amazon's pipeline and Kobo didn't care which was used and neither of us was going to waste anymore time worrying about it.
|
|
|
|
|
|
#9 | |
|
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Jul 2026
Device: Kobo Glo
|
Quote:
Basically, I was trying to see if my current work flow would benefit from using it. Thank you for explaining the philosophy behind how it works. |
|
|
|
|
|
|
#10 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,841
Karma: 7500000
Join Date: Nov 2009
Device: many
|
If it helps, a Sigil output plugin could easily be created to save any epub to Windows without any crlfs in it.
But be aware if you use git for version control that by default git auto handles crlf conversion on Windows commits and checkouts so you may be in for a surprise if using the default git for revision control. And fwiw I think there is a Linux subsystem on Windows that now supports gui apps that would of course not need or use crlf. Hope something here helps. |
|
|
|
|
|
#11 | |
|
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Jul 2026
Device: Kobo Glo
|
Quote:
I have used the Linux Subsystem on Windows before, but found it clunky, but thank you for the additional information. |
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| The never ending saga | PeterT | Lounge | 4 | 07-27-2021 03:06 AM |
| Never Ending | oldgoat | Which one should I buy? | 4 | 09-01-2016 03:53 PM |
| ISBN ending in X? | eezergoode | Calibre | 13 | 09-08-2011 10:20 PM |
| Never ending Synchronization | Raedwulf | Sony Reader | 8 | 11-02-2009 01:05 AM |