Re: TextEdit and Unicode
Re: TextEdit and Unicode
- Subject: Re: TextEdit and Unicode
- From: Bill <email@hidden>
- Date: Thu, 19 Feb 2004 00:09:28 +0800
Hi, I've been working on a script to convert HTML to a text file using
Safari
and TextEdit. I am able to get the text, but I have come across a
tricky
problem. It seem that the text I get from Safari is unicode 16, which
is not
at all unexpected. The problem is when I use TextEdit to save the
retrieved
text to a file. I always get a message saying that the text in the new
document needs to be saved with a different character set such as
unicode 16.
I then have to press OK and go through the save file dialogue.
Wesley,
You may consider use do shell script to call the shell command
"defaults", quit TextEdit.app and relaunch it. The following one change
the save option to UTF-8, for other text encoding options, change it
manually and check it by defaults read.
-- change default Plain Text Encoding save option to UTF-8
do shell script "defaults write com.apple.textedit
PlainTextEncodingForWrite 4"
-- check default Plain Text Encoding save option
do shell script "defaults read com.apple.textedit
PlainTextEncodingForWrite"
However, I would suggest using the shell command "curl" instead of
Safari; and, avoid to use GUI scripting to click the options.
Have fun :)
bill
_______________________________________________
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.