text in fields (CR/LF, CR, LF) which is correct?

Kee Nethery kee at kagi.com
Fri Aug 30 12:46:18 CDT 2002


>Dar Scott <dsc at swcp.com> wrote:
>
>>I would prefer a new constant named lineEnd that is _Revolution_ 
>>specific.  This would allow the same stack to move across platforms 
>>without line end changes.
>
>That's pretty much what "cr" and "return" do already.
>
>>For backwards compatibility, it should be ASCII 10.  Maybe there 
>>can be a short name, but line and end are already taken.
>>
>>With that, new constants asciiCR, asciiLF, and asciiCRLF are also defined.
>>
>>With the above, use of return and CR can be discouraged.  And 
>>lineFeed and CRLF need not be used.
>>
>>
>>However, I've seen examples from old timers on the list that 
>>include return quite a bit.  I find that jarring and sometimes 
>>confusing.  Yet, others might find it quite natural.
>
>It's a holdover from HyperCard and SuperCard, where "return" has 
>been in use since the beginning. As you say, it's very natural for 
>anyone coming from another xtalk environment. The synonym "cr" is 
>what others probably want to use, it's the same thing.
>
>I'm not convinced we need a new constant though, but of course I 
>could easily be missing something. I have always just used "cr" or 
>"return" (interchangeably) and line endings have always been 
>converted correctly no matter what platform I move my stack to. 
>Never had any problems with it. If hard binary data needs to be 
>converted, as in the case we've been discussing, then I just replace 
>the appropriate ascii characters with "cr" or "return" and it fixes 
>things. This also works when writing text files; the correct line 
>endings get written depending on the platform. I suppose if you were 
>writing binary data, you'd need a switch statement to write the 
>correct line endings depending on platform, but those constants 
>already exist.


Since CR as a constant is not documented anywhere that I can find in 
my docs, I'm looking for someone on the various non-Mac OS X 
platforms to run the following statement in their message box (on 
windows, on Linux/Unix, on Mac OS 9) and return the results. Just 
want to make sure CR really does vary with each platform.

put the number of chars in CR
put chartonum(char 1 of CR)

and if the number of chars is more than 1
put chartonum(char <x> of CR)

Sorry to be such a pest, I'm not getting my data from a text file, 
I'm not getting my data from a URL, I am getting it via a database 
connection and unless I manually muck with the text, it will not 
display properly. If there are changes to the text, I have to 
manually convert it back to what the database expects so that it gets 
stored properly. I cannot use these silent behind the scenes 
"Revolution will do it for you" kinds of file saves.

Thanks all for the help.

Kee Nethery





More information about the use-livecode mailing list