Last active
August 29, 2015 14:17
-
-
Save tmsanrinsha/7b26f1ec3b1ab7acc738 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function utf8mac2utf8(str) { | |
var utf8marArr = ["が","ぎ","ぐ","げ","ご","ざ","じ","ず","ぜ","ぞ","だ","ぢ","づ","で","ど","ば","ぱ","び","ぴ","ぶ","ぷ","べ","ぺ","ぼ","ぽ","ゔ","ガ","ギ","グ","ゲ","ゴ","ザ","ジ","ズ","ゼ","ゾ","ダ","ヂ","ヅ","デ","ド","バ","パ","ビ","ピ","ブ","プ","ベ","ペ","ボ","ポ","ヴ","ヷ","ヸ","ヹ","ヺ"]; | |
var utf8Arr = ["が","ぎ","ぐ","げ","ご","ざ","じ","ず","ぜ","ぞ","だ","ぢ","づ","で","ど","ば","ぱ","び","ぴ","ぶ","ぷ","べ","ぺ","ぼ","ぽ","ゔ","ガ","ギ","グ","ゲ","ゴ","ザ","ジ","ズ","ゼ","ゾ","ダ","ヂ","ヅ","デ","ド","バ","パ","ビ","ピ","ブ","プ","ベ","ペ","ボ","ポ","ヴ","ヷ","ヸ","ヹ","ヺ"]; | |
for (var i = 0, len = utf8marArr.length; i < len; i++) { | |
str = str.replace(utf8marArr[i], utf8Arr[i], "g"); | |
} | |
return str; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment