Created
September 9, 2015 05:29
-
-
Save violetyk/7c546d13847461cc61b8 to your computer and use it in GitHub Desktop.
機種依存文字やASCII制御文字を下駄文字(12307)に変更する
This file contains hidden or 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
def to_geta(str) | |
ng_codepoints = [ | |
*0x00..0x09, | |
*0x0b..0x0c, | |
*0x0e..0x1f, | |
0x7f, | |
*0x2150..0x219F, | |
*0x2460..0x24EF, | |
*0x2600..0x2660, | |
*0x3220..0x324F, | |
*0x3280..0x33FF, | |
0x2028, | |
] | |
str.unpack("U*").map { |v| ng_codepoints.include?(v) ? 12307 : v }.pack("U*") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment