Hello all,
When I create a Textpad file of type "Unix" with "ANSI" encoding, it uses normal LF endings like:
Hello{LF}
World{LF}
{LF}
But, when I use the "PC" type with "ANSI" encoding, it only uses CRLF on the final line:
Hello{LF}
World{LF}
{CR}{LF}
The "official" Windows line ending standard would call for {CR}{LF} terminators on each line. The Textpad help file claims that PC-type files have a CRLF terminator on each line, but they don't -- only the final 2 bytes of a multi-line file contain CRLF.
This behavior doesn't cause any problems for me but I would really like to know why they choose that convention. I have looked everywhere for info on this but can't find any good explanation.
Regards,
Reuben
Textpad's use of CR LF line endings
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
Berend Hasselman
Re: Textpad's use of CR LF line endings
What exactly are you doing?
I tried to reproduce your results but couldn't.
I saved a file as Unix then resaved as PC and got exactly the correct line endings in both cases.
Berend Hasselman
I tried to reproduce your results but couldn't.
I saved a file as Unix then resaved as PC and got exactly the correct line endings in both cases.
Berend Hasselman
-
Andreas
Re: Textpad's use of CR LF line endings
Same as Berend Hasselman with me - I get the correct endings.
-
Reuben Logsdon
Re: Textpad's use of CR LF line endings
Thanks for checking this. I'm sorry, the problem was with my Perl script for analyzing line endings. I was using
if ($text =~ m!^(.*)\015(.*)$!s) {
instead of:
if ($text =~ m!^(.*?)\015(.*)$!s) {
which caused my script to only detect the second-to-last char. Some of my test files had mixed CRLF and LF endings and so the script was finding middle-file CR chars in those, and that prevented me from seeing my mistake immediately.
Thanks a lot for the feedback.
if ($text =~ m!^(.*)\015(.*)$!s) {
instead of:
if ($text =~ m!^(.*?)\015(.*)$!s) {
which caused my script to only detect the second-to-last char. Some of my test files had mixed CRLF and LF endings and so the script was finding middle-file CR chars in those, and that prevented me from seeing my mistake immediately.
Thanks a lot for the feedback.