In both files most lines end with hexadecimal 0D 0A
which is carriage return
. But in both files there are also lines ending with just 0A
. So both text files are a mixture of DOS and UNIX. The PDF converter interprets only 0D 0A
as line termination and ignores 0A
before. It would be really interesting how these two text files were created because if the creation was done with an application, the application has same bugs.
To solve this you have to configure UltraEdit as I use since more than 15 years: convert all 0D
without next byte being 0A
to 0D 0A
and all 0A
without preceding byte being 0D
also to 0D 0A
to have every file loaded as DOS/Windows text file.
Open Advanced - Settings or Configuration - File Handling - DOS/Unix/Mac Handling
- Default file type for new files: DOS
- Unix/Mac file detection/conversion: Automatically convert to DOS format
- Only recognize DOS terminated lines (CR/LF) as new lines for editing: not checked
- Save file as input format (Unix/Mac/DOS): checked
- Status bar shows original line terminator format (on disk): checked
And in configuration at File Handling - Conversions
enable On paste convert line endings to destination type (Unix/Mac/DOS)
to avoid pasting UNIX terminated lines copied to clipboard in a different application into the text file opened in UltraEdit with DOS terminated lines with just 0A
as line ending. With this setting enabled UltraEdit makes the same line ending conversion on every paste as on opening a file.
Then opening original.txt
results in loading it as DOS/Windows text file as most lines end with carriage return
. Inserting a space, immediately removing it with key BACKSPACE and saving the modified file results in an increase in file size from 3317 bytes to 3348 bytes. This means UltraEdit has added on the 31 lines ending with just line-feed
the missing carriage return
. Also edit.txt
is opened with these settings as DOS/Windows text file and saving it after a dummy modification results in increasing file size from 3275 to 3286 bytes, i.e. inserting additional 11 carriage return
Now both text files containing only 0D 0A
as line ending can be converted to PDF and the PDF files has the same number of lines as the text file in UltraEdit.
And yes, the status bar is the bar at bottom having the encoding selector and in the box before showing DOS
depending on (main) line ending type of active file.