Project

General

Profile

Feature #12034 ยป 0001-string.c-rb_external_str_with_enc-fall-back-to-ASCII.patch

rebased - nobu (Nobuyoshi Nakada), 02/09/2016 04:30 AM

View differences:

string.c
959 959
	return str;
960 960
    }
961 961
    rb_enc_associate_index(str, eidx);
962
    if (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN) {
963
	rb_enc_associate_index(str, rb_ascii8bit_encindex());
964
	return str;
965
    }
962 966
    return rb_str_conv_enc(str, eenc, rb_default_internal_encoding());
963 967
}
964 968

  
test/ruby/test_dir_m17n.rb
72 72
        opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
73 73
        ents = Dir.entries(".", opts)
74 74
        filename = "%FF" if /darwin/ =~ RUBY_PLATFORM && ents.include?("%FF")
75
        assert_include(ents, filename)
75
        assert_include(ents, filename.b)
76
        ents.each { |f| assert_predicate f, :valid_encoding? }
76 77
      EOS
77 78
    }
78 79
  end unless /mswin|mingw/ =~ RUBY_PLATFORM
79
-