Re: Applescript-users Digest, Vol 2, Issue 458
Re: Applescript-users Digest, Vol 2, Issue 458
- Subject: Re: Applescript-users Digest, Vol 2, Issue 458
- From: Emile Schwarz <email@hidden>
- Date: Wed, 13 Jul 2005 10:36:53 +0200
Hi Kumar,
What version of Mac OS X are you running ?
What do you mean with "characters of different languages" ?
Did you use ASCII characters ?
Did you use characters not defined in the ASCII table ?
If so, what encoding did you apply ?
What encoding did you use to:
a. save the text (save to text file),
b. open the text file.
> when I close and reopen the document, all these characters are converted
> to junk.
No, TextEdit opens the document with its default encodings which can be
different from the one you use to save the data...
> When I save the document manually, things are fine.
Yes, this is probably because the Encoding used for save and open is the same.
What happens to you si tu ne lis pas le Français and I start to write in a
different language ? [in this case, the 'language' is the 'encoding')
Nota 1:
tell application "TextEdit"
set foo to "foo"
save document 1 in foo
end tell
create an empty document on the hard disk root _without extension, without Type
And Creator_...
Nota 2:
I ran the above script after typing some ASCII _AND_ accentuated characters like
a acute, grave, circ, uml etc. Then I open the generated file with TextEdit
(drag to the TextEdit icon in the Dock) and Mac OS X 10.4.1 renders the
characters fine.
In short, I presume that you are using Mac OS X prior Tiger (10.4), you didn't
know about Encodings (Unicode) and so you are in trouble.
The 10.4.1 TextEdit dictionary entry for save says:
<quote>
save v : Save an object.
save reference : the object for the command
[as Unicode text] : The file type in which to save the data.
[in alias] : The file in which to save the object.
</quote>
Try to open the data in TextEdit using different encodings (File -> Open; in the
open dialog, choose an encoding in the popup menu list) until you find the
correct one (the one who will not display "junk") and you're done.
That is all I can say to help on the subject.
E.
email@hidden wrote:
From: "Kumar Shailove" <email@hidden>
Subject: Saving a TextEdit document using AS
To: <email@hidden>
Message-ID:
<email@hidden>
Content-Type: text/plain; charset="us-ascii"
Hi list,
I am typing characters of different languages in a TextEdit document,
and then saving using AppleScript.
tell application "TextEdit"
save document 1 in <filepath>
end tell
when I close and reopen the document, all these characters are converted
to junk.
When I save the document manually, things are fine.
Am I doing something wrong.
Thanks in Advance.
_______________________________________________
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