Skip to content

Instantly share code, notes, and snippets.

@suna-pan
Last active January 2, 2016 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suna-pan/8368900 to your computer and use it in GitHub Desktop.
Save suna-pan/8368900 to your computer and use it in GitHub Desktop.
強いユニコードで攻撃して罪に問われるのを防止するプラグイン
# -*- coding: utf-8 -*-
Plugin.create(:mikutter_unicode) do
filter_gui_postbox_post do |postbox|
text = Plugin.create(:gtk).widgetof(postbox).widget_post.buffer.text
text = text.unpack('U*').collect! do |i|
unless(i == 0xfffd)
[i].pack('U')
else
next
end
end.join
widget = Gtk::PostBox.list.first.widget_post
widget.buffer.text = text
[postbox]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment