Page 1 of 1

CRLF in Windows OS gives a double space

Posted: Tue Jul 08, 2008 7:56 pm
by churchken
Hi,

A ".txt" file, opened with Windows notepad, appears "single-spaced".

But, when that file is "read" into my REV script, using the URL command, and placed into a field, it appears "double-spaced". Then if that field is written to a new .txt file using the URL command, that new file also is "double-spaced" when opened in Windows notepad.

Is there a way to "replace" the CRLF that is causing the double spacing and get single spaced text into the REV field?

Thanks for any ideas.

Posted: Tue Jul 08, 2008 8:26 pm
by malte
Hi,

your almost there

replace crlf with cr in fld "myField"

should do the trick.

Hope that helps,

Malte

replace CRLF with CR

Posted: Tue Jul 08, 2008 8:38 pm
by churchken
Malte,

Thanks for your quick reply.

I had already tried that replace code, and it did not alter the result.

My OS is windows XP, and this issue seems to be in how REV and the OS interpret the CRLF.

I might add that this is happening on a .txt file that is "written" directly to disk by another program, so I don't know if that program is using an unexpected control character for the CRLF.

Any other ideas?

Posted: Tue Jul 08, 2008 9:09 pm
by BvG
if you mean "all chars have additional spaces" when you say double-spaced, then most likely the original file is unicode of some sorts. I never have used it, but rev has ways to read unicode text.

double spaced

Posted: Tue Jul 08, 2008 9:32 pm
by churchken
Bvg,

Sorry for the confusion. No, by "double spaced" I meant that each line seems to have 2 CRLF characters. The text on each line has no unwanted spaces within the individual characters. But, after each line, there is a blank line before the next line of text. Here is an example:

2008-07-03,115.953125,6,510,115.953125,115.968750,1978,0,0

2008-07-03,115.953125,12,504,115.953125,115.968750,1976,0,0

2008-07-03,115.953125,1,492,115.953125,115.968750,1974,0,0


The original file is written to disk by a program that takes data directly from a port feed. Perhaps there is some unusual transmission code involved.

Again, thanks for the help.

Posted: Wed Jul 09, 2008 2:28 am
by malte
Hi Ken,

sorry for the confusion. You would need to do the replace before you put the data into the field. Read the URL into a variable replace there and put into a field fterwards. Or do a replace cr&cr with cr on the field or filter the field without empty. There is a few choices to go about this. The reason is, that rev converts lf to cr characters internally when putting data into the field. So for rev it looks like a double cr character instead of lf.

Hope that helps,

malte

thanks

Posted: Wed Jul 09, 2008 3:38 am
by churchken
Malte,

Thanks SO much !

Doing the replace in a variable before putting the result into a field was exactly what worked.

Many thanks.