UTF-8 テキスト ファイルの最初の行を読み取る Applescript を作成しました。その文字列は、IRC クライアント (Textual) の特定のテキスト領域に「値を設定」するために使用されます。
残念ながら、Mac OS Roman エンコーディングにネイティブでない文字 (Unicode のみの文字、アジア言語のみのグリフ) は、Mac OS Roman 文字に置き換えられます。
例えば:
- ≫ ようこそ
テキスト領域に次のように書き込まれます。
- ようこそ
テキストを強制的に UTF-8 エンコーディングに戻したり、この問題を修正したりするにはどうすればよいですか?
私のスクリプト:
set source to "/Users/admin/Documents/file.txt" --UTF-8 file
set N to paragraphs of (read POSIX file source)
set phrase to first item of N
tell application "Textual" --IRC client
activate
tell application "System Events"
delay 0.3
set value of text area 1 of scroll area 1 of window 1 of process "Textual" to phrase
--the main text entry field of this application
keystroke return
end tell
end tell