diff options
| author | xibbar <xibbar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-20 12:29:29 +0000 |
|---|---|---|
| committer | xibbar <xibbar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-20 12:29:29 +0000 |
| commit | a233f479508c0b1071abd4b48fc22aa59f5bd847 (patch) | |
| tree | f9c1076c96fe9cf638324e8d264e84defe84672f | |
| parent | 84abfd5bc077fb92db3b2a55eccf905d17bb8901 (diff) | |
| download | ruby-a233f479508c0b1071abd4b48fc22aa59f5bd847.tar.gz ruby-a233f479508c0b1071abd4b48fc22aa59f5bd847.tar.xz ruby-a233f479508c0b1071abd4b48fc22aa59f5bd847.zip | |
* lib/cgi/core.rb (read_multipart): file's encoding is ascii-8bit
from file field of multipart form.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | lib/cgi/core.rb | 12 |
2 files changed, 11 insertions, 6 deletions
@@ -1,3 +1,8 @@ +Mon Oct 20 21:19:00 2008 Takeyuki FUJIOKA <xibbar@ruby-lang.org> + + * 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@ruby-lang.org> * ext/zlib/zlib.c (Init_zlib): add getbyte as an alias to getc. diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb index f2bbb0a61..3a934c928 100644 --- a/lib/cgi/core.rb +++ b/lib/cgi/core.rb @@ -495,14 +495,14 @@ class CGI 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 @@ class CGI 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 @@ class CGI 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 |
