0

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
4

1 に答える 1

1

試す:

set N to paragraphs of (read POSIX file source as «class utf8»)
于 2014-02-08T15:44:20.253 に答える