URL-decode an application/x-www-form-urlencoded string with encoding(optional).
string = CGI.unescape("%27Stop%21%27+said+Fred") # => "'Stop!' said Fred"
URL-encode a string following RFC 3986 Space characters (+“ ”+) are encoded with (+“%20”+)
url_encoded_string = CGI.escapeURIComponent("'Stop!' said Fred") # => "%27Stop%21%27%20said%20Fred"
Unescape a string that has been HTML-escaped
CGI.unescapeHTML("Usage: foo "bar" <baz>") # => "Usage: foo \"bar\" <baz>"
Creates a printable version of the digest object.
Creates a class to wrap the C struct described by signature
.
MyStruct = struct ['int i', 'char c']
Similar to read, but raises EOFError
at end of string instead of returning nil
, as well as IO#sysread
does.
Reads at most maxlen bytes from the stream. If buf is provided it must reference a string which will receive the data.
See IO#readpartial
for full details.
Pushes character c back onto the stream such that a subsequent buffered character read will return it.
Unlike IO#getc
multiple bytes may be pushed back onto the stream.
Has no effect on unbuffered reads (such as sysread).
Returns true
if field 'Transfer-Encoding'
exists and has value 'chunked'
, false
otherwise; see Transfer-Encoding response header:
res = Net::HTTP.get_response(hostname, '/todos/1') res['Transfer-Encoding'] # => "chunked" res.chunked? # => true
Zlib::GzipReader
wrapper that unzips data
.
Add file name
with permissions mode
size
bytes long. Yields an IO
to write the file to.