Re: Opening and reading a text file
Re: Opening and reading a text file
- Subject: Re: Opening and reading a text file
- From: Emmanuel LEVY <email@hidden>
- Date: Tue, 29 Jan 2013 12:32:58 +0100
On Jan 28, 2013, at 16:41, Ed Rush <email@hidden> wrote:
> I'm trying to open an existing text file, add some HTML code, and write the result to replace a pre-existing second file, but I keep getting an end-of-file error right off the bat:
>
> --read the books list
> set booksList to read sourceFile as Unicode text using delimiter return
> close access sourceFile
You can get an eof error if you attempt to read a file which is, say, Macintosh-encoded, while pretending to read it as Unicode text (which, I suppose, is utf16).
This is because characters are encoded over several bytes.
If you read it as Macintosh - which writes one byte per character - that kind of eof error can't occur.
In other words, maybe you're trying to read as unicode some file which is not unicode encoded. Or maybe utf8. I didn't follow the thread.
Emmanuel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden