Created
September 5, 2010 08:23
-
-
Save kompiro/565852 to your computer and use it in GitHub Desktop.
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
irb(main):001:0> source = "=?ISO-2022-JP?B?GyRCIXcbKEJJVBskQj83Q2VCLkpzGyhCIC0=?= =?ISO-2022-JP?B?IDIwMTAvOS8zGyRCISEbKEI=?= =?ISO-2022-JP?B?GyRCOkdNJUBoO3Y5YCRPIUhAZEJQJW0bKEI=?= =?ISO-2022-JP?B?GyRCITwlcyVBJDUkOyRrJDMkSCEqIUkbKEI=?=" | |
=> "=?ISO-2022-JP?B?GyRCIXcbKEJJVBskQj83Q2VCLkpzGyhCIC0=?= =?ISO-2022-JP?B?IDIwMTAvOS8zGyRCISEbKEI=?= =?ISO-2022-JP?B?GyRCOkdNJUBoO3Y5YCRPIUhAZEJQJW0bKEI=?= =?ISO-2022-JP?B?GyRCITwlcyVBJDUkOyRrJDMkSCEqIUkbKEI=?=" | |
irb(main):002:0> require 'kconv' | |
=> true | |
irb(main):003:0> source.toutf8() | |
error: | |
=> "@IT新着速報 -" | |
except: | |
=> "@IT新着速報 - 2010/9/3 最優先事項は“絶対ローンチさせること!”" |
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 decode_subject (subject) | |
res = "" | |
subject.split(' ').each do |word| | |
res = res + NKF.nkf("-dJw", word) | |
end | |
return res | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NKF.nkf("-wJ",source)を繰り返すと、それぞれの=?ISO-2022-JP...の区間ごとのデコードできる。