Is #CRLF$ obsolete?

Just starting out? Need help? Post your questions and find answers here.
User avatar
skywalk
Addict
Addict
Posts: 4279
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Is #CRLF$ obsolete?

Post by skywalk »

Just checking since Windows 10+ respects #LF$ in most occurrences, why do we need the extra byte?
Where is #CRLF$ absolutely necessary?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
jacdelad
Addict
Addict
Posts: 2052
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: Is #CRLF$ obsolete?

Post by jacdelad »

Processing text files. Like ANSI: Usually not standard anymore, but not always.
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
User avatar
idle
Always Here
Always Here
Posts: 6150
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Is #CRLF$ obsolete?

Post by idle »

it's necessary for http requests if you make them manually, though I can't think of where else it's necessary.
BarryG
Addict
Addict
Posts: 4303
Joined: Thu Apr 18, 2019 8:17 am

Re: Is #CRLF$ obsolete?

Post by BarryG »

#CRLF$ is required by standard Internet Protocols like HTTP, SMTP, POP, and IMAP.

More discussion: https://news.ycombinator.com/item?id=41830717
User avatar
skywalk
Addict
Addict
Posts: 4279
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Is #CRLF$ obsolete?

Post by skywalk »

Yeah, I vaguely remember some special cases with email and http.
But those should improve over time.
Most controls and cmd and file editors are fine with #LF$.
Let's see how many bugs I create in my code now. :twisted:
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
BarryG
Addict
Addict
Posts: 4303
Joined: Thu Apr 18, 2019 8:17 am

Re: Is #CRLF$ obsolete?

Post by BarryG »

It doesn't matter if it's obsolete anyway. If you don't want to use it, then don't.
plouf
Enthusiast
Enthusiast
Posts: 284
Joined: Fri Apr 25, 2003 6:35 pm
Location: Athens,Greece

Re: Is #CRLF$ obsolete?

Post by plouf »

Imho for full compatibility

For example other oses (amigaos-limux) only require 1 byte since 80s-90s

But a lot of software/protocol/logic is buolt on that logic these 3 decades

So if you want to to something on your own do it as you like
If you built something with unkown external input

Like processing text files from outside source go classical
Christos
User avatar
skywalk
Addict
Addict
Posts: 4279
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Is #CRLF$ obsolete?

Post by skywalk »

Well, my bugs are a plenty :evil:
But, not too hard to solve.
I did not realize the Windows edit control gadget does not respond to an #EM_SETENDOFLINE message?
Are the PB gadgets not Windows 10?
PB Help wrote:- GetGadgetText(): Get the text content of the editor gadget. Please note, that several lines of text are separated with "Chr(13)+Chr(10)" on Windows and "Chr(10)" on Linux and OS X.
But the api allows for #LF EOL char with the following.
Bummer, it fails, so I have to replace the EOLs.

MS API

Code: Select all

; Make EOL char = #LF
; Rich Edit Control
#EM_SETEDITSTYLEEX              = #WM_USER + 275
#SES_EX_NOTABLE                 = 4
#EM_SETENDOFLINE                = $0511
#EC_ENDOFLINE_DETECTFROMCONTENT = 0
#EC_ENDOFLINE_CRLF              = 1
#EC_ENDOFLINE_CR                = 2
#EC_ENDOFLINE_LF                = 3
SendMessage_(#Editor, #EM_SETENDOFLINE, #EC_ENDOFLINE_LF, 0) ; Requires Windows 10+
; Fail, return 0
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Post Reply