Re-2: Removing CRLF from text
Hi all, I've tried all replies to this issue and the one that works is from Martin Baxter, using: put URL (binfile: tFilename) into tData put tData into fld Original --this results in displaying a box character at the end of each line --now look for the set of string characters that I want to remove put + CRLF into tmatchstring --the order that the string you're looking for is important replace tmatchstring with space in tData replace with empty in tData --the replace character is the last char of each line from the Original field. I copied this character into the script --place the result into a field for display put tData into fld Changed From my Changed field (the result of the script), I copied the text from it, saved it with Notepad and viewed the file with a Hex Editor. The characters at the end of each line are: (Hex=0d0d0a) which is 13 13 10 RunRev translation: cr cr lf Remember, this is all from using... put URL (binfile: tFilename) into tData From the saved file above, I used it as the ini file for the software application, and the application works with it - no problem. The net result is, this works using: put URL (binfile:. when trying to do what I need to do ... ... bring broken INI entries into one line, per ini entry. Thanx all for your interesting responses. It shows how awesome, diverse and I might say in a nice way, indulgent, each RunRev developer is. Regards, Mark Stuart ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Re-2: Removing CRLF from text
Sorry for the late response been preoccupied; haven't the Olympics been hypnotic! Did you see the Venus Williams vs Li Na tennis - unbelievable!!! On Sun, Aug 10, 2008 at 11:01 AM, Mark Stuart [EMAIL PROTECTED] wrote: And this is because of cross platform compatibility? Would I be correct in my deductions? Yes. I would like to find this in the products documentation somewhere. Anyone know where I might find this? In the Dictionary, type in 'open file', in the first paragraph of the Comments. Of course it would be nice if these same comments appeared under the 'URL' entry and every other entry where it applies:-) And Kay, on you volunteering me - no problem, but I find myself unqualified to do so. :-) Gee, had a problem, found the solution, two solutions to be precise; consider yourself qualified:-) ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re-2: Removing CRLF from text
Kay C Lan wrote: Mark, although you seem to have got a solution with binfile, does it work with 'file' but just replacing + LF ? Also agree that everything learnt from this thread should make it to the newsletter. I volunteer Mark Stuart ;-) Kay, you are correct in your question. :-) Here's the script using just file: on mouseUp --clear display fields on card --these fields are for displaying the results. put empty into fld Before put empty into fld After --fetch the file put c:\temp\some.ini into tFilename put URL (file: tFilename) into tData put tData into fld Before replace + LF with empty in tData put tData into fld After end mouseUp After reading all the threads on this topic, I deduce the following: When reading the file into a memory variable, RunRev applies manipulation to the EOL chars in the tData variable. It replaces CR and LF with just LF. So when using - put URL (file: tFilename) into tData - I would use the + LF, in this case. And this is because of cross platform compatibility? Would I be correct in my deductions? I would like to find this in the products documentation somewhere. Anyone know where I might find this? And Kay, on you volunteering me - no problem, but I find myself unqualified to do so. :-) Regards, Mark Stuart ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Re-2: Removing CRLF from text
Kay C Lan wrote: On Thu, Aug 7, 2008 at 11:34 PM, Ken Ray [EMAIL PROTECTED] wrote: Actually IIRC, it's done this way to standardize *internal* interpretation on all the platforms (much like Rev standardizes on forward slash for path delimiters). That way, regardless of whether the host OS uses LF only, CR only or CRLF, when text data is read in from the outside it is all converted internally to use the LF character (ASCII 10). If you want to read in the actual end-of-line (EOL) delimiters, you can read the file in *as binary*: Might then that explain why Mark Stuart could only get the 'binfile' version of a solution to work. Sarah and Jacque told him to replace + CRLF with , but if what you say is correct, then Rev has already removed CRLFs, no such combo should exist? That's correct. Mark, although you seem to have got a solution with binfile, does it work with 'file' but just replacing + LF ? That is an alternative approach that should also work. Martin Baxter -- I am Not a Number, I am a free NaN ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re-2: Removing CRLF from text
crlf and cr are not the same! from the docu: Use the CRLF constant as an easier-to-read substitute for numToChar(13) numToChar(10). cr is numToChar(13) only. Runrev engages in text fields for optimization according to the used OS = you do in most cases not see the differences when using text fields. When using variables and binfiles the difference of crlf and cr can be important. In runrev you often have relicts of LineFeed LF (10) when using ftp from a win pc to a unix os. In this cases you have to replace crlf with cr (=remove numToCHar(10). Regards, Franz Original Messageprocessed by David InfoCenter Subject: Re: Removing CRLF from text (07-Aug-2008 13:30) From:Randy Hengst [EMAIL PROTECTED] To: [EMAIL PROTECTED] Hi Mark, I played with your question by pasting your text example into a field, demo, and by grabbing a text file using the URL pattern you shared. I thought that CR and LF are basically the same thing. So, when I used: replace +CR with in field demo it seemed to work. I used RevStudio 2.9 on MacOSX4.11. take care, randy --- On Aug 6, 2008, at 7:17 PM, mfstuart wrote: Hi, RunRev: 2.90 OS: WinXP I have a situation where a software application's ini file has the plus (+) char and CRLF at the end of a line, when the line passes 80 characters. The balance of the ini entry is placed on the next line. Each ini entry could be very long and possibly go to 3 lines. Why they did this I don't know, really. But what I need to do is remove the + and CRLF so that each ini entry is complete in itself, on one line. ini file currently contains: dfgsdfg sdfgsd fgsdfgsdf gsdfg + sdfgadfs dgdghs dfdfgg fghf+ dfgh dfgh Result I'd like after running the script: dfgsdfg sdfgsd fgsdfgsdf gsdfg sdfgadfs dgdghs dfdfgg fghf dfgh dfgh I've used this script, and variations of it, to remove these characters: + CRLF. It removes the + char, but still leaves each ini entry split into multiple lines. I've also searched the archives for a solution, nothing is working. Any ideas? My script: on mouseUp --clear current fields on card --these fields are so that I can see the results from the script. put empty into fld Orig put empty into fld Changed --fetch the file put C:/temp/some.ini into tFilename put URL (file: tFilename) into tData put tData into fld Orig repeat for each line L in tData --grab the line put L into tLine --If the line contains +, then it will also contain CR and LF, --so only work on a line with +. if (tLine contains +) then --find + and delete it put offSet(+,tLine) into tPos delete char tPos to tPos in tLine --find CR and delete it put offSet(CR,tLine) into tPos delete char tPos to tPos in tLine --find LF and delete it put offSet(LF,tLine) into tPos delete char tPos to tPos in tLine --put the line into a container so that I can see the results put tLine cr after theLines else -- just put the line into a container put tLine cr after theLines end if end repeat put theLines into fld Changed end mouseUp Regards, Mark Stuart -- View this message in context: http://www.nabble.com/Removing-CRLF-from-text-tp18862004p18862004.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution To: use-revolution@lists.runrev.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Re-2: Removing CRLF from text
On 7 Aug 2008, at 12:52, [EMAIL PROTECTED] wrote: crlf and cr are not the same! from the docu: Use the CRLF constant as an easier-to-read substitute for numToChar(13) numToChar(10). cr is numToChar(13) only. Be careful. In Rev, cr is numToChar(10) and is a synonym for return and lf. Cheers Dave ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Re-2: Removing CRLF from text
Be careful. In Rev, cr is numToChar(10) and is a synonym for return and lf. Are you sure about that? 10 is LF, and I've never experienced a problem with getting the two mixed up. Perhaps the application that's generating your EOL's is putting in a LF instead of a CR? -- On the first day, God created the heavens and the Earth On the second day, God created the oceans. On the third day, God put the animals on hold for a few hours, and did a little diving. And God said, This is good. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Re-2: Removing CRLF from text
Hi mikey, Be careful. In Rev, cr is numToChar(10) and is a synonym for return and lf. Are you sure about that? 10 is LF, and I've never experienced a problem with getting the two mixed up. Perhaps the application that's generating your EOL's is putting in a LF instead of a CR? Attentione, signore! You are talking to Mr. LibUrl himself! :-D From the docs about return (= CR): ... Summary: Equivalent to the line feed character (ASCII 10, Control-J). ... Regards Klaus Major [EMAIL PROTECTED] http://www.major-k.de ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Re-2: Removing CRLF from text
hmm. weird. Thanks for the info. -- On the first day, God created the heavens and the Earth On the second day, God created the oceans. On the third day, God put the animals on hold for a few hours, and did a little diving. And God said, This is good. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Re-2: Removing CRLF from text
On 7 Aug 2008, at 14:32, Mikey wrote: Be careful. In Rev, cr is numToChar(10) and is a synonym for return and lf. Are you sure about that? Fairly. :-) Try this in the message box put charToNum(cr) Cheers Dave ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Re-2: Removing CRLF from text
Weird again. I have learned more things today that I wished I did not. I wonder why it's implemented this way. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Re-2: Removing CRLF from text
Hi Mikey, On Unix systems, the line delimiter is ASCII 10. On HyperCard, ASCII 13 was used. On HyperCard is was called a return and a way had to be invented to make conversion of HyperCard stacks, as well as HyperCard users, to Revolution as easy as possible. Treating both linefeeds and returns as linefeeds as equals really made this easier. The question remains, what would have happened if Revolution had used ASCII 13? Probably, this would have complicated using Rev stacks as shell and CGI scripts in Unix systems. -- Economy-x-Talk Consultancy and Software Engineering http://economy-x-talk.com http://www.salery.biz Get your store on-line within minutes with Salery Web Store software. Download at http://www.salery.biz Op 7-aug-2008, om 16:34 heeft Mikey het volgende geschreven: Weird again. I have learned more things today that I wished I did not. I wonder why it's implemented this way. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Re-2: Removing CRLF from text
Mark, Maybe I have several funky Unix boxes, then, but all the applications on these buggers still go CRLF, which is really annoying, but that's the way it is. I could have sworn that several of the 'net protocols also still go CRLF, but it's been several years since the last server I wrote. If memory serves me right both SMTP and POP3 EOL via that combo. -- On the first day, God created the heavens and the Earth On the second day, God created the oceans. On the third day, God put the animals on hold for a few hours, and did a little diving. And God said, This is good. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Re-2: Removing CRLF from text
Weird again. I have learned more things today that I wished I did not. I wonder why it's implemented this way. Actually IIRC, it's done this way to standardize *internal* interpretation on all the platforms (much like Rev standardizes on forward slash for path delimiters). That way, regardless of whether the host OS uses LF only, CR only or CRLF, when text data is read in from the outside it is all converted internally to use the LF character (ASCII 10). If you want to read in the actual end-of-line (EOL) delimiters, you can read the file in *as binary*: put url (file:myfilePath) into tVar -- EOLs are now all LFs put url (binfile:myfilePath) into tVar -- EOLs are all preserved As to why LF was standardized as the internal representation? Well, I would have to assume it's from Rev's roots - originally it was called MetaCard and was developed for UNIX only... over time it migrated to the Windows and then Mac platforms, and eventually became Revolution. And back in those days, the LF char was used for the EOL character (although nowadays I think Linux supports LF and CRLF, but I'm not sure). Ken Ray Sons of Thunder Software, Inc. Email: [EMAIL PROTECTED] Web Site: http://www.sonsothunder.com/ ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Re-2: Removing CRLF from text
It's just weird for someone coming from tools where CR means ASCII(13) and LF means ASCII(10). I don't think I've run across a tool where CR means 10 until now. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Re-2: Removing CRLF from text
Mark Schonewille wrote: On Unix systems, the line delimiter is ASCII 10. On HyperCard, ASCII 13 was used. On HyperCard is was called a return and a way had to be invented to make conversion of HyperCard stacks, as well as HyperCard users, to Revolution as easy as possible. Treating both linefeeds and returns as linefeeds as equals really made this easier. The question remains, what would have happened if Revolution had used ASCII 13? Probably, this would have complicated using Rev stacks as shell and CGI scripts in Unix systems. Another questions might be: Should Rev consider using real CR (ASCII 13)for the constant CR, perhaps with a global property that can be set for compatibility. Internally it could continue to use ASCII 10 as the main line delimiter, merely encouraging folks to use LF where they commonly use CR today. Mikey's response is not unique; it seems all of us have scratched our head over this at one time or another. We learned it and moved on, grateful that our habits of old Mac-specific HyperTalk were able to be carried forward. But for Rev to be successful, we must see more users in the next five years than have ever used the product before, and things which reduce head-scratching will aid adoption. Just a thought. I'm sure there are others. :) -- Richard Gaskin Managing Editor, revJournal ___ Rev tips, tutorials and more: http://www.revJournal.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re-2: Removing CRLF from text
Hi all, I’ve tried all replies to this issue and the one that works is from Martin Baxter, using: put URL (binfile: tFilename) into tData put tData into fld “Original” --this results in displaying a “box” character at the end of each line --now look for the set of string characters that I want to remove put + CRLF into tmatchstring --the order that the string you’re looking for is important replace tmatchstring with space in tData replace with empty in tData --the replace character is the last char of each line from the “Original” field. I copied this character into the script --place the result into a field for display put tData into fld Changed From my “Changed” field (the result of the script), I copied the text from it, saved it with Notepad and viewed the file with a Hex Editor. The characters at the end of each line are: (Hex=0d0d0a) which is 13 13 10 RunRev translation: cr cr lf Remember, this is all from using… put URL (binfile: tFilename) into tData From the saved file above, I used it as the ini file for the software application, and the application works with it – no problem. The net result is, this works using: put URL (“binfile:”….. when trying to do what I need to do … … bring “broken” INI entries into one line, per ini entry. Thanx all for your interesting responses. It shows how awesome, diverse and I might say in a nice way, indulgent, each RunRev developer is. Regards, Mark Stuart p.s. I sent this same email from my work email address (which is not registered with this list), so you may see it twice. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Re-2: Removing CRLF from text
I just love the tone on this list - despite the fact that I'm nearly always wrong, y'all are exceptionally patient and kewl with it. -- On the first day, God created the heavens and the Earth On the second day, God created the oceans. On the third day, God put the animals on hold for a few hours, and did a little diving. And God said, This is good. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Re-2: Removing CRLF from text
[EMAIL PROTECTED] wrote: Thanx all for your interesting responses. It shows how awesome, diverse and I might say in a nice way, indulgent, each RunRev developer is. Regards, Mark Stuart I think the lessons learned in this thread could make a nice Rev newsletter article. -- Phil Davis PDS Labs Professional Software Development http://pdslabs.net ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Re-2: Removing CRLF from text
In another tool that I use VERY frequently, these little tidbits are referred to as the Tao, because they are simply details regarding The Way and the rationale behind The Way that the environment is designed, and once one has an understanding of The Tao, many of the mysteries are much less so. One might sometimes refer to such things as Stuff that might at first seem counterintuitive or surprising, but that's a lot longer to type. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Re-2: Removing CRLF from text
On Thu, Aug 7, 2008 at 11:34 PM, Ken Ray [EMAIL PROTECTED] wrote: Actually IIRC, it's done this way to standardize *internal* interpretation on all the platforms (much like Rev standardizes on forward slash for path delimiters). That way, regardless of whether the host OS uses LF only, CR only or CRLF, when text data is read in from the outside it is all converted internally to use the LF character (ASCII 10). If you want to read in the actual end-of-line (EOL) delimiters, you can read the file in *as binary*: Might then that explain why Mark Stuart could only get the 'binfile' version of a solution to work. Sarah and Jacque told him to replace + CRLF with , but if what you say is correct, then Rev has already removed CRLFs, no such combo should exist? Mark, although you seem to have got a solution with binfile, does it work with 'file' but just replacing + LF ? Also agree that everything learnt from this thread should make it to the newsletter. I volunteer Mark Stuart ;-) ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution