• 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
text Encoding with Write to file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: text Encoding with Write to file
      • From: Christopher Nebel <email@hidden>
    • Re: text Encoding with Write to file
      • From: jj <email@hidden>
  • Prev by Date: Looking for one or more testers for XMail POP3 authentication.
  • Next by Date: Re: text Encoding with Write to file
  • Previous by thread: Looking for one or more testers for XMail POP3 authentication.
  • Next by thread: Re: text Encoding with Write to file
  • Index(es):
    • Date
    • Thread