Re: Unicode to plain text
Re: Unicode to plain text
- Subject: Re: Unicode to plain text
- From: John Delacour <email@hidden>
- Date: Sat, 21 Sep 2002 13:13:00 +0100
At 4:51 pm -0700 20/9/02, Paul Berkowitz wrote:
> Does that make things any clearer?
Partially, but not completely. I'm not talking about a script editor's
display.
Read more carefully what I have written.
If pick a file on my desktop, change my Keyboard menu to Japanese, and type
in a number of Japanese characters to rename it, then do this:
tell application "Finder"
set theName to name of item 1 of (get selection)
end tell
set plainName to ((theName as record)'s <<class ktxt>>)
it does not error.
I have explained that there are about 15000 and Japanese and Han
characters in the old charsets. The chance of your typing characters
that are not included in this number is very low unless you know
which they are, so this is no test.
Enter characters from languages that you KNOW are not in the old
charsets. That's why I used Lao and fancy Greek, but you can choose
whatever you like using either UnicodeChecker or the Character
Palette.
set s to c(254) & c(255)
repeat with i from 48 to 55
set s to s & c(38) & c(i)
end repeat
set f to "" & (path to temporary items) & "yi.txt"
open for access file f with write permission
set eof file f to 0
write s to file f
close access file f
tell app "Finder" to open file f using application file id "ttxt"
tell app "TextEdit" to set uText to get paragraph 1 of document 1
try
uText as record
on error e
return {uText, e}
end try
--> {"????????", "Can't make \"????????\" into a record."}
on c(n)
ASCII character n
end c
JD
_______________________________________________
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.