@@ -755,12 +755,75 @@ class InvalidEncoding < Exception; end
755755 #
756756 @@accept_charset = "UTF-8" if false # needed for rdoc?
757757
758- # Return the accept character set for all new CGI instances.
758+ # :call-seq:
759+ # CGI.accept_charset -> encoding
760+ #
761+ # Returns the default accept character set to be used for new \CGI instances;
762+ # see CGI.accept_charset=.
759763 def self . accept_charset
760764 @@accept_charset
761765 end
762766
763- # Set the accept character set for all new CGI instances.
767+ # :call-seq:
768+ # CGI.accept_charset = encoding
769+ #
770+ # Sets the default accept character set to be used for new \CGI instances;
771+ # returns the argument.
772+ #
773+ # The argument may be an Encoding object or an Encoding name;
774+ # see {Encodings}[https://docs.ruby-lang.org/en/master/language/encodings_rdoc.html]:
775+ #
776+ # # The initial value.
777+ # CGI.accept_charset # => "UTF-8"
778+ # CGI.new
779+ # # =>
780+ # #<CGI:0x0000018991db6ae8
781+ # @accept_charset="UTF-8",
782+ # @accept_charset_error_block=nil,
783+ # @cookies={},
784+ # @max_multipart_length=134217728,
785+ # @multipart=false,
786+ # @options={accept_charset: "UTF-8", max_multipart_length: 134217728},
787+ # @output_cookies=nil,
788+ # @output_hidden=nil,
789+ # @params={}>
790+ #
791+ # # Set by Encoding name.
792+ # CGI.accept_charset = 'US-ASCII' # => "US-ASCII"
793+ # CGI.new
794+ # # =>
795+ # #<CGI:0x0000018991cf4100
796+ # @accept_charset="US-ASCII",
797+ # @accept_charset_error_block=nil,
798+ # @cookies={},
799+ # @max_multipart_length=134217728,
800+ # @multipart=false,
801+ # @options={accept_charset: "US-ASCII", max_multipart_length: 134217728},
802+ # @output_cookies=nil,
803+ # @output_hidden=nil,
804+ # @params={}>
805+ #
806+ # # Set by Encoding object.
807+ # CGI.accept_charset = Encoding::ASCII_8BIT # => #<Encoding:BINARY (ASCII-8BIT)>
808+ # CGI.new
809+ # # =>
810+ # #<CGI:0x0000018991cfc800
811+ # @accept_charset=#<Encoding:BINARY (ASCII-8BIT)>,
812+ # @accept_charset_error_block=nil,
813+ # @cookies={},
814+ # @max_multipart_length=134217728,
815+ # @multipart=false,
816+ # @options={accept_charset: #<Encoding:BINARY (ASCII-8BIT)>, max_multipart_length: 134217728},
817+ # @output_cookies=nil,
818+ # @output_hidden=nil,
819+ # @params={}>
820+ #
821+ # The given encoding is not checked in this method,
822+ # but if it is invalid, a call to CGI.new will fail:
823+ #
824+ # CGI.accept_charset = 'foo'
825+ # CGI.new # Raises ArgumentError: unknown encoding name - foo
826+ #
764827 def self . accept_charset = ( accept_charset )
765828 @@accept_charset = accept_charset
766829 end
0 commit comments