Re: text Encoding with Write to file
Re: text Encoding with Write to file
- Subject: Re: text Encoding with Write to file
- From: jj <email@hidden>
- Date: Mon, 09 Jan 2006 11:38:05 +0100
- Thread-topic: text Encoding with Write to file
> Well the problem is that I want to write a file with MacRoman text
> encoding. I found a lot on the internet and it doesn't work
>
> They said that write [...] as string will be MacRoman text encoding
> but this doesn't work.
Works flawlessly here (OS X 10.4.3).
Anyway, where are you writing your scripts. It's that the line:
on write(theFile, theContents)
Should compile as:
on write {theFile, theContents}
And overriding osaxen commands isn't considered a safe practice ;-)
For instance:
###############################
on write {theFile, theContents}
try
set fd to open for access file theFile with write permission
set eof of fd to 0
write theContents to fd -- this will be UTF-16
close access fd
on error ErrMsg
close access fd
display dialog ErrMsg
end try
end write
###############################
The line "write theContents..." should be calling to your handler itself, as
you're fake-re-defining the meaning and usage of the command "write". And,
as such, throwing an error, as "theContents to fd" doesn't match the
expected parameters for "on write {theFile, theContents}". On the other
hand, if it would, you would have an infinite loop...
jj
--
http://www.macscripter.net/
http://www.osaxen.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden