module Base64
def strict_encode64(bin)
Base64.strict_encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK"
s = "This is line 1\nThis is line 2\n"
Base64.strict_encode64("\n\n\n") # => "CgoK"
which will be encoded as ordinary \Base64:
The string to be encoded may itself contain newlines,
# => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg=="
Base64.strict_encode64('*' * 46)
Base64.strict_encode64('*') # => "Kg=="
see {Newlines}[Base64.html#module-Base64-label-Newlines] above:
The returned string will have no newline characters, regardless of its length;
Base64.strict_encode64('*') # => "Kg==\n"
see {Padding}[Base64.html#module-Base64-label-Padding] above.
The returned string may include padding;
Base64.strict_encode64("\xFF\xFF\xFF") # => "////\n"
Base64.strict_encode64("\xFB\xEF\xBE") # => "++++\n"
see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above:
+ or /;
Per RFC 2045, the returned string may contain the URL-unsafe characters
Returns a string containing the RFC-2045-compliant \Base64-encoding of +string+.
Base64.strict_encode64(string) -> encoded_string
:call-seq:
def strict_encode64(bin) [bin].pack("m0") end