Skip to content

Instantly share code, notes, and snippets.

@matthauck
matthauck / gist:4563666
Created January 18, 2013 10:25
utf-8 broken in jruby 1.7.2 windows
# encoding: utf-8
require 'tempfile'
def valid_utf8(str)
str.encoding == Encoding::UTF_8 && str.valid_encoding?
end
str = <<-EOF
My UTF-8 String: ✓ ®
@matthauck
matthauck / global_ca_hack.rb
Created June 21, 2012 23:04
Net::HTTP global ca hack
require 'net/http'
module Net
class HTTP
# Creates a new Net::HTTP object for the specified +address+.
# This method does not open the TCP connection.
def initialize(address, port = nil)
@address = address
@port = (port || HTTP.default_port)