Re: Reading file containing UTF-8
Re: Reading file containing UTF-8
- Subject: Re: Reading file containing UTF-8
- From: julifos <email@hidden>
- Date: Wed, 05 Nov 2003 20:39:47 +0100
>
> I think these two will do the job:
>
>
>
> do shell script "cat ~/whatever/file.txt"
>
>
>
> read alias "path:to:file.txt" as <<class utf8>>
>
>
Thanks for the reply jj. That does work, right up until I add until
>
linefeed9, then it returns Unicode text but doesn9t recognise the UTF-8
>
sequences:
>
>
property somefile : alias ((path to desktop as text) & "Temporary Find List6
>
copy.txt")
>
property linefeed : ASCII character 10 -- Unix
>
>
set a to (read somefile until linefeed) as <<class utf8>>
>
>
log class of a
>
>
I need the read the file in chunks (line by line) because it9s going to be 15
>
Megs or so.
Hmmm... Seems that such code works fine here... Are you sure that LF is in
contents of such file? (well, most probably you are)
You can try instead reading the file in chunks. Eg:
repeat with i from 1 to contentsLength by 50000
try
read xfile from i to (i+50000)
on error
read xfile from i to -1
end try
end repeat
jj
_______________________________________________
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.