แบบว่า บางที พิมพ์ไปโคตระเยอะ ... ดันลืมเปลี่ยนภาษาซะงั้น
แล้วด้วยความขี้เกียจ(พิมพ์ใหม่) เลยเขียนยัดใส่บอทซะ
สรุปว่า ไม่มีไรมาก แค่อีก 1 funtion ที่ยัดลงไปในบอท (ไร้สาระสุดๆ 555+)
อาจจะมีผิดบ้าง เพราะตอนเทียบ hex ตาลายชะมัด เขียนเสร็จเลยขี้เกียจทดสอบ *-*
แต่ใช้แล้วคิดว่าถูกราวๆ 95% ล่ะมั้ง
sub en2th{
my $eninput = $_[0];
my %h=("\x21"=>"\x2b", "\x22"=>"\x2e", "\x23"=>"\xf2", "\x24"=>"\xf3", "\x25"=>"\xf4", "\x26"=>"\xdf", "\x27"=>"\xa7", "\x28"=>"\xf6", "\x29"=>"\xf7",
"\x2a"=>"\xf5", "\x2b"=>"\xf9", "\x2c"=>"\xc1", "\x2d"=>"\xa2", "\x2e"=>"\xe3", "\x2f"=>"\xbd",
"\x30"=>"\xa8", "\x31"=>"\xe5", "\x32"=>"\x2f", "\x33"=>"\x2d", "\x34"=>"\xc0", "\x35"=>"\xb6", "\x36"=>"\xd8", "\x37"=>"\xd6", "\x38"=>"\xa4", "\x39"=>"\xb5",
"\x3a"=>"\xab", "\x3b"=>"\xc7", "\x3c"=>"\xb2", "\x3d"=>"\xaa", "\x3e"=>"\xcc", "\x3f"=>"\xc6",
"\x40"=>"\xf1", "\x41"=>"\xc4", "\x42"=>"\xda", "\x43"=>"\xa9", "\x44"=>"\xaf", "\x45"=>"\xae", "\x46"=>"\xe2", "\x47"=>"\xac", "\x48"=>"\xe7", "\x49"=>"\xb3",
"\x4a"=>"\xeb", "\x4b"=>"\xc9", "\x4c"=>"\xc8", "\x4d"=>"\x3f", "\x4e"=>"\xec", "\x4f"=>"\xcf",
"\x50"=>"\xad", "\x51"=>"\xf0", "\x52"=>"\xb1", "\x53"=>"\xa6", "\x54"=>"\xb8", "\x55"=>"\xea", "\x56"=>"\xce", "\x57"=>"\x22", "\x58"=>"\x29", "\x59"=>"\xed",
"\x5a"=>"\x28", "\x5b"=>"\xba", "\x5c"=>"\xa3", "\x5d"=>"\xc5", "\x5e"=>"\xd9", "\x5f"=>"\xf8",
"\x60"=>"\x60", "\x61"=>"\xbf", "\x62"=>"\xd4", "\x63"=>"\xe1", "\x64"=>"\xa1", "\x65"=>"\xd3", "\x66"=>"\xb4", "\x67"=>"\xe0", "\x68"=>"\xe9", "\x69"=>"\xc3",
"\x6a"=>"\xe8", "\x6b"=>"\xd2", "\x6c"=>"\xca", "\x6d"=>"\xb7", "\x6e"=>"\xd7", "\x6f"=>"\xb9",
"\x70"=>"\xc2", "\x71"=>"\xe6", "\x72"=>"\xbe", "\x73"=>"\xcb", "\x74"=>"\xd0", "\x75"=>"\xd5", "\x76"=>"\xcd", "\x77"=>"\xe4", "\x78"=>"\xbb", "\x79"=>"\xd1",
"\x7a"=>"\xbc", "\x7b"=>"\xb0", "\x7c"=>"\xb5", "\x7d"=>"\x2c",
"\xa1"=>"\x64", "\xa2"=>"\x2d", "\xa3"=>"\x5c", "\xa4"=>"\x38", "\xa5"=>"\x7c", "\xa6"=>"\x53", "\xa7"=>"\x27", "\xa8"=>"\x30", "\xa9"=>"\x43",
"\xaa"=>"\x3d", "\xab"=>"\x3a", "\xac"=>"\x47", "\xad"=>"\x50", "\xae"=>"\x45", "\xaf"=>"\x44",
"\xb0"=>"\x7b", "\xb1"=>"\x52", "\xb2"=>"\x3c", "\xb3"=>"\x49", "\xb4"=>"\x66", "\xb5"=>"\x39", "\xb6"=>"\x35", "\xb7"=>"\x6d", "\xb8"=>"\x54", "\xb9"=>"\x6f",
"\xba"=>"\x5b", "\xbb"=>"\x58", "\xbc"=>"\x5a", "\xbd"=>"\x2f", "\xbe"=>"\x72", "\xbf"=>"\x61",
"\xc0"=>"\x34", "\xc1"=>"\x2c", "\xc2"=>"\x70", "\xc3"=>"\x69", "\xc4"=>"\x41", "\xc5"=>"\x5d", "\xc6"=>"\x3f", "\xc7"=>"\x3b", "\xc8"=>"\x4c", "\xc9"=>"\x4b",
"\xca"=>"\x6c", "\xcb"=>"\x73", "\xcc"=>"\x3e", "\xcd"=>"\x76", "\xce"=>"\x56", "\xcf"=>"\x4f",
"\xd0"=>"\x74", "\xd1"=>"\x79", "\xd2"=>"\x6b", "\xd3"=>"\x65", "\xd4"=>"\x62", "\xd5"=>"\x75", "\xd6"=>"\x37", "\xd7"=>"\x6e", "\xd8"=>"\x36", "\xd9"=>"\x5e",
"\xda"=>"\x42", "\xdf"=>"\x26",
"\xe0"=>"\x37", "\xe1"=>"\x63", "\xe2"=>"\x46", "\xe3"=>"\x2e", "\xe4"=>"\x77", "\xe5"=>"\x31", "\xe6"=>"\x71", "\xe7"=>"\x48", "\xe8"=>"\x6a", "\xe9"=>"\x68",
"\xea"=>"\x55", "\xeb"=>"\x4a", "\xec"=>"\x4e", "\xed"=>"\x59",
"\xf0"=>"\x51", "\xf1"=>"\x40", "\xf2"=>"\x23", "\xf3"=>"\x24", "\xf4"=>"\x25", "\xf5"=>"\x37", "\xf6"=>"\x28", "\xf7"=>"\x29",
"\xf8"=>"\x2d", "\xf9"=>"\x2b"
);
$eninput =~ s/([\x21-\x7D\xA1-\xDA\xDF-\xED\xF0-\xF9])/$h{$1}/ig;
$thai = $eninput;
return ($thai);
}
No comments:
Post a Comment