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
# encoding: utf-8 | |
require 'tempfile' | |
def valid_utf8(str) | |
str.encoding == Encoding::UTF_8 && str.valid_encoding? | |
end | |
str = <<-EOF | |
My UTF-8 String: ✓ ® |
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
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) |
NewerOlder