Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if RUBY_PLATFORM =~ /win|mingw/
- require 'iconv'
- alias old_puts puts
- alias old_gets gets
- Iconv_outer = Iconv.new("cp866", "utf-8")
- Iconv_inner = Iconv.new("utf-8", "cp866")
- def puts(*args)
- old_puts args.map { |p| p.is_a?(String) ? Iconv_outer.iconv(p) : p }
- end
- def gets
- Iconv_inner.iconv(old_gets)
- end
- end
Add Comment
Please, Sign In to add comment