OS Xの「サービス」を使用して、文字化けした丸数字を元に戻す。
Windowsから来たメールやテキストなどに、
よく使用されている①、②などの丸数字は、
Macだと文字化けしてしまいます。
それを簡単に元に戻す方法を紹介します。
単なる文字置換ですけど…
【作成方法】
アプリケーション > Automator > サービスを選択。
ライブラリ > AppleScriptを実行をダブルクリック。
画像のように、AppleScriptコードを入力して、
「◯数字変換」などの適当な名前で保存します。
▼AppleScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
on run {input, parameters} try set a to the (input as string) set c to repChar(a, "㈰", "①") of me set c to repChar(c, "㈪", "②") of me set c to repChar(c, "㈫", "③") of me set c to repChar(c, "㈬", "④") of me set c to repChar(c, "㈭", "⑤") of me set c to repChar(c, "㈮", "⑥") of me set c to repChar(c, "㈯", "⑦") of me set c to repChar(c, "㉀", "⑧") of me set c to repChar(c, "㈷", "⑨") of me set c to repChar(c, "㉂", "⑩") of me set c to repChar(c, "㉃", "⑪") of me set c to repChar(c, "㈹", "⑫") of me set c to repChar(c, "㈺", "⑬") of me set c to repChar(c, "㈱", "⑭") of me set c to repChar(c, "㈾", "⑮") of me set c to repChar(c, "㈴", "⑯") of me set c to repChar(c, "㈲", "⑰") of me set c to repChar(c, "㈻", "⑱") of me set c to repChar(c, "㈶", "⑲") of me set c to repChar(c, "㈳", "⑳") of me end try return c end run --文字置換ルーチン on repChar(origText, targStr, repStr) set {txdl, AppleScript's text item delimiters} to {AppleScript's text item delimiters, targStr} set temp to text items of origText set AppleScript's text item delimiters to repStr set res to temp as text set AppleScript's text item delimiters to txdl return res end repChar |
【使い方】
テキストエディットなどで
文字化けした文字列を選択して、
作成したサービスを選択すると、
上の図のように変換されます。
他にも、改行の変換や簡易校正など、
色々と使い道がありそうです。
参考情報
WindowsからiPhone/iPod touch/Macに送ってはいけない文字とは?