Talk About Network

Google




Programming > Applescript > Re: Read UTF-8 ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 4 Topic 1536 of 1697
Post > Topic >>

Re: Read UTF-8 file

by Sander Tekelenburg <user@[EMAIL PROTECTED] > Nov 23, 2007 at 04:23 AM

In article <towb-B60E07.19292522112007@[EMAIL PROTECTED]
>,
 Tobias Weber <towb@[EMAIL PROTECTED]
> wrote:

> In article <user-54F565.18254822112007@[EMAIL PROTECTED]
>,
>  Sander Tekelenburg <user@[EMAIL PROTECTED]
> wrote:
> 
> > set nameList to (read listFile as «class utf8» using delimiter return)

> > as list
> 
> That seems to be the correct answer to my "how to combise two 'as' 
> parameters" question. Unfortunately in trying it I found out that as 
> utf8 clashes with using delimiter and reverts to MacRoman. The following

> works:
> 
> open for access listFile without write permission
> set nameText to read listFile as «class utf8»
> close access listFile
> set nameList to every paragraph of nameText

Good catch :)

Btw, no need to open for access if you only need to read the file. Added 
bonus is that you won't need the usual error handling stuff for when 
something fails and your script doesn't close access (thus keeping the 
file inaccessible to any process).

set nameList to every paragraph of (read listFile as «class utf8»)

-- 
Sander Tekelenburg, <http://www.euronet.nl/~tekelenb/>

Mac user: "Macs only have 40 viruses, tops!"
PC user: "SEE! Not even the virus writers sup****t Macs!"
 




 4 Posts in Topic:
Read UTF-8 file
Tobias Weber <towb@[EM  2007-11-22 02:43:09 
Re: Read UTF-8 file
Sander Tekelenburg <us  2007-11-22 18:25:48 
Re: Read UTF-8 file
Tobias Weber <towb@[EM  2007-11-22 19:29:25 
Re: Read UTF-8 file
Sander Tekelenburg <us  2007-11-23 04:23:09 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Mon Jan 5 17:16:53 PST 2009.