ruby-changes:8330
From: xibbar <ko1@a...>
Date: Mon, 20 Oct 2008 21:29:46 +0900 (JST)
Subject: [ruby-changes:8330] Ruby:r19858 (trunk): * lib/cgi/core.rb (read_multipart): file's encoding is ascii-8bit
xibbar 2008-10-20 21:29:29 +0900 (Mon, 20 Oct 2008) New Revision: 19858 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19858 Log: * lib/cgi/core.rb (read_multipart): file's encoding is ascii-8bit from file field of multipart form. Modified files: trunk/ChangeLog trunk/lib/cgi/core.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 19857) +++ ChangeLog (revision 19858) @@ -1,3 +1,8 @@ +Mon Oct 20 21:19:00 2008 Takeyuki FUJIOKA <xibbar@r...> + + * lib/cgi/core.rb (read_multipart): file's encoding is ascii-8bit + from file field of multipart form. + Mon Oct 20 20:16:25 2008 Yukihiro Matsumoto <matz@r...> * ext/zlib/zlib.c (Init_zlib): add getbyte as an alias to getc. Index: lib/cgi/core.rb =================================================================== --- lib/cgi/core.rb (revision 19857) +++ lib/cgi/core.rb (revision 19858) @@ -495,14 +495,14 @@ def create_body(is_large) #:nodoc: if is_large require 'tempfile' - body = Tempfile.new('CGI') + body = Tempfile.new('CGI', encoding: "ascii-8bit") else begin require 'stringio' - body = StringIO.new + body = StringIO.new("".force_encoding("ascii-8bit")) rescue LoadError require 'tempfile' - body = Tempfile.new('CGI') + body = Tempfile.new('CGI', encoding: "ascii-8bit") end end body.binmode if defined? body.binmode @@ -568,7 +568,7 @@ read_from_cmdline end.dup.force_encoding(@accept_charset) ) - unless @accept_charset=="ASCII-8BIT" || @accept_charset==Encoding::ASCII_8BIT + unless @accept_charset=~/ASCII-8BIT/i || @accept_charset==Encoding::ASCII_8BIT @params.each do |key,values| values.each do |value| unless value.valid_encoding? @@ -603,9 +603,9 @@ if value return value elsif defined? StringIO - StringIO.new("") + StringIO.new("".force_encoding("ascii-8bit")) else - Tempfile.new("CGI") + Tempfile.new("CGI",encoding:"ascii-8bit") end else str = if value then value.dup else "" end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/