• 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
reading Unicode text files before AS 1.9.1
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

reading Unicode text files before AS 1.9.1


  • Subject: reading Unicode text files before AS 1.9.1
  • From: Donald Hall <email@hidden>
  • Date: Thu, 4 Mar 2004 00:13:47 -0700

The test script below works correctly in AS 1.9.1, but fails in AS 1.9.

My test file contains the following saved as 16 bit Unicode data:

aaa<tab>bbb<tab>ccc<return>
ddd<tab>eee<tab>fff<return>

(I used TextEdit to create the file.)

In AS 1.9.1 (OS 10.2.6) I get 3 "paragraphs" detected as expected,
the last one being empty. (In other words "theData" is a list of 3
items.)

In AS 1.9 (OS 10.2.3) I get 1 paragraph (a list of 1 item) that
contains the whole contents of the file.

Can anyone suggest a way to read in Unicode text in AS 1.9 that gives
me the correct number of paragraphs?

Thanks,

Don


-- begin test script -----------------------------------------------
set aFile to choose file
set theData to readData from aFile


-- read data from file -----------------------------------------------
to readData from aFile
set dataFileRef to (open for access aFile)
if (get eof dataFileRef) is 0 then
error "The data file \"" & (POSIX path of aFile as
text) & "\" is empty." number -32744
end if
set theData to every paragraph of (read dataFileRef as Unicode text)
close access dataFileRef
display dialog "theData is " & return & theData
display dialog "number of lines detected is " & (count of theData)
return theData -- a list of the lines in the data file
end readData

-- end test script --------------------------------------------------

--
Donald S. Hall, Ph.D.
Apps & More Software Design, Inc.
email@hidden
http://www.appsandmore.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: reading Unicode text files before AS 1.9.1
      • From: Paul Berkowitz <email@hidden>
  • Prev by Date: Re: do shell script modifies alias path
  • Next by Date: Re: reading Unicode text files before AS 1.9.1
  • Previous by thread: Re: do shell script modifies alias path
  • Next by thread: Re: reading Unicode text files before AS 1.9.1
  • Index(es):
    • Date
    • Thread