• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Opening and reading a text file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Opening and reading a text file (From: Ed Rush <email@hidden>)
 >Re: Opening and reading a text file (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: Opening and reading a text file
  • Next by Date: Re: Opening and reading a text file
  • Previous by thread: Re: Opening and reading a text file
  • Next by thread: Re: Opening and reading a text file
  • Index(es):
    • Date
    • Thread