merge revision(s) 33991:

* file.c (file_path_convert): don't convert it when the path string is
	  ascii only. [ruby-core:41556] [Bug #5733]
	  tests are contributed by nobu.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@36735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2012-08-20 08:14:11 +00:00
parent b800677425
commit f869ed2ff3
4 changed files with 32 additions and 4 deletions

View file

@ -1,3 +1,9 @@
Mon Aug 20 17:11:01 2012 NARUSE, Yui <naruse@ruby-lang.org>
* file.c (file_path_convert): don't convert it when the path string is
ascii only. [ruby-core:41556] [Bug #5733]
tests are contributed by nobu.
Thu Aug 9 22:48:58 2012 NARUSE, Yui <naruse@ruby-lang.org>
* pack.c (pack_unpack): when unpack('M') occurs an illegal byte

4
file.c
View file

@ -138,8 +138,10 @@ file_path_convert(VALUE name)
if (rb_default_internal_encoding() != NULL
&& rb_usascii_encoding() != fname_encoding
&& rb_ascii8bit_encoding() != fname_encoding
&& (fs_encoding = rb_filesystem_encoding()) != fname_encoding) {
&& (fs_encoding = rb_filesystem_encoding()) != fname_encoding
&& !rb_enc_str_asciionly_p(name)) {
/* Don't call rb_filesystem_encoding() before US-ASCII and ASCII-8BIT */
/* fs_encoding should be ascii compatible */
name = rb_str_conv_enc(name, fname_encoding, fs_encoding);
}
#endif

View file

@ -1,4 +1,5 @@
require 'test/unit'
require 'envutil'
class TestEncodingConverter < Test::Unit::TestCase
def check_ec(edst, esrc, eres, dst, src, ec, off, len, opts=nil)
@ -908,4 +909,23 @@ class TestEncodingConverter < Test::Unit::TestCase
ec2 = Encoding::Converter.new("", "", newline: :universal)
assert_equal(ec1, ec2)
end
def test_default_external
cmd = <<EOS
Encoding.default_external = ext = ARGV[0]
Encoding.default_internal = int ='utf-8'
begin
Encoding::Converter.new(ext, int)
ensure
Marshal.dump($!, STDOUT)
STDOUT.flush
end
EOS
Encoding.list.grep(->(enc) {/^ISO-8859-\d(?:[0-5])?\z/i =~ enc.name}) do |enc|
error = IO.popen([EnvUtil.rubybin, "-e", cmd, enc.name]) do |child|
Marshal.load(child)
end
assert_nil(error)
end
end
end

View file

@ -1,10 +1,10 @@
#define RUBY_VERSION "1.9.3"
#define RUBY_PATCHLEVEL 260
#define RUBY_PATCHLEVEL 261
#define RUBY_RELEASE_DATE "2012-08-09"
#define RUBY_RELEASE_DATE "2012-08-20"
#define RUBY_RELEASE_YEAR 2012
#define RUBY_RELEASE_MONTH 8
#define RUBY_RELEASE_DAY 9
#define RUBY_RELEASE_DAY 20
#include "ruby/version.h"