On 20 May 2005, at 18:55, Gregory Lypny wrote:

Hello Everyone,

I'm having a bit of trouble with the Get URL ("ftp://...";) and one particular file.

I have a tab-delimited text file with 227 lines. Call it theFile.txt. I have a copy on my local Mac at home, and I've placed a copy on my remote Mac at the office. When I use the handler below to get the file from the remote server, it appears in the field in my stack as one long garbled line; in other words, it looks like I've lost the return characters. When I tried to import other text files that were already on the remote server, they come through fine. When I import the file a local folder, it is fine.

I'd guess it is connected to the way the file was created (and perhaps the way it was placed on the server). If it is a text file created on a Mac, then the line endings will most likely be numToChar (13). libUrl does ftp downloads as binary which means no conversrion takes place. Internally, Rev uses numToChar(10) for line endings, so it won't see line endings in the file.


I find the safest way to deal with text downloads whose source is uncertain is to use the following routine, which will clean up line endings regardless of the source of the text.

on cleanLineEndings @pText
  replace crlf with return in pText
  replace numToChar(13) with return in pText
end cleanLineEndings

Cheers
Dave
_______________________________________________
use-revolution mailing list
[email protected]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to