@@ -934,12 +934,75 @@ class InvalidEncoding < Exception; end
934934 #
935935 @@accept_charset = "UTF-8" if false # needed for rdoc?
936936
937- # Return the accept character set for all new CGI instances.
937+ # :call-seq:
938+ # CGI.accept_charset -> encoding
939+ #
940+ # Returns the default accept character set to be used for new \CGI instances;
941+ # see CGI.accept_charset=.
938942 def self . accept_charset
939943 @@accept_charset
940944 end
941945
942- # Set the accept character set for all new CGI instances.
946+ # :call-seq:
947+ # CGI.accept_charset = encoding
948+ #
949+ # Sets the default accept character set to be used for new \CGI instances;
950+ # returns the argument.
951+ #
952+ # The argument may be an Encoding object or an Encoding name;
953+ # see {Encodings}[https://docs.ruby-lang.org/en/master/language/encodings_rdoc.html]:
954+ #
955+ # # The initial value.
956+ # CGI.accept_charset # => "UTF-8"
957+ # CGI.new
958+ # # =>
959+ # #<CGI:0x0000018991db6ae8
960+ # @accept_charset="UTF-8",
961+ # @accept_charset_error_block=nil,
962+ # @cookies={},
963+ # @max_multipart_length=134217728,
964+ # @multipart=false,
965+ # @options={accept_charset: "UTF-8", max_multipart_length: 134217728},
966+ # @output_cookies=nil,
967+ # @output_hidden=nil,
968+ # @params={}>
969+ #
970+ # # Set by Encoding name.
971+ # CGI.accept_charset = 'US-ASCII' # => "US-ASCII"
972+ # CGI.new
973+ # # =>
974+ # #<CGI:0x0000018991cf4100
975+ # @accept_charset="US-ASCII",
976+ # @accept_charset_error_block=nil,
977+ # @cookies={},
978+ # @max_multipart_length=134217728,
979+ # @multipart=false,
980+ # @options={accept_charset: "US-ASCII", max_multipart_length: 134217728},
981+ # @output_cookies=nil,
982+ # @output_hidden=nil,
983+ # @params={}>
984+ #
985+ # # Set by Encoding object.
986+ # CGI.accept_charset = Encoding::ASCII_8BIT # => #<Encoding:BINARY (ASCII-8BIT)>
987+ # CGI.new
988+ # # =>
989+ # #<CGI:0x0000018991cfc800
990+ # @accept_charset=#<Encoding:BINARY (ASCII-8BIT)>,
991+ # @accept_charset_error_block=nil,
992+ # @cookies={},
993+ # @max_multipart_length=134217728,
994+ # @multipart=false,
995+ # @options={accept_charset: #<Encoding:BINARY (ASCII-8BIT)>, max_multipart_length: 134217728},
996+ # @output_cookies=nil,
997+ # @output_hidden=nil,
998+ # @params={}>
999+ #
1000+ # The given encoding is not checked in this method,
1001+ # but if it is invalid, a call to CGI.new will fail:
1002+ #
1003+ # CGI.accept_charset = 'foo'
1004+ # CGI.new # Raises ArgumentError: unknown encoding name - foo
1005+ #
9431006 def self . accept_charset = ( accept_charset )
9441007 @@accept_charset = accept_charset
9451008 end
0 commit comments