text Encoding with Write to file
text Encoding with Write to file
- Subject: text Encoding with Write to file
- From: Bastiaan Boertien <email@hidden>
- Date: Mon, 9 Jan 2006 11:18:28 +0100
Hi List
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
What I'm doing at this moment is something like this
property TMPFile : missng value
init()
write(TMPFile, "the string that the file must contain")
iConv(TMPFile,"path:to:destination")
on init()
set TMPFile to (path to temporary folder) & myOutput.txt
end init
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
on iConv(inputFile, outputFile)
do shell script "iconv -f UTF-16 -t MACROMAN " & inputFile & " > " &
outputFile
end iConv
This will result in a file with a text encoding MacRoman. In Mac OS
10.3.x I didn't have to do this last step 'iConv'. Does anyone know
how I can do this, like in Mac OS 10.3.x, without iconv?
When I use write [...] as string will work but when you write a file
that starts with a '§' or '•' then applescript will write the file as
UTF-16.
Thanks in advance
Greetings Bastiaan
_______________________________________________
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