Proper Text Returns Mac -> Win ?

Richard Gaskin ambassador at fourthworld.com
Fri Nov 14 15:09:01 EST 2008


Scott Rossi wrote:
> I'm sure this is ridiculously easy, but am wondering if anyone can explain
> to me how to generate a simple text document on OS X that has return
> characters which read properly Windows.  I've tried replacing return
> characters with different values, writing as binary (binfile) data instead
> of file, and still the text refuses to wrap properly on Windows.  My dumb
> workaround wound up being to physically copy and paste text into a Win text
> file.
> What am I missing?

Remember that Mac and Unix use a single character, but Windows uses two:

Mac: carriage return (ASCII 13)
Unix: line feed (ASCII 10)
Win: return followed by linefeed

Internally, the Rev engine uses the Unix convention (ASCII 10), which is 
confusing since it also uses "CR" as the mnemonic for that, which isn't 
accurate (but at least makes it easy to port scripts from HC).

So this should work:

   replace CR with CRLF in tMyData
   put tMyData into url ("binfile:Somefolder/Somefile.txt")


-- 
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com



More information about the use-livecode mailing list