[#73707] [Ruby trunk Misc#12004] Code of Conduct — hanmac@...
Issue #12004 has been updated by Hans Mackowiak.
3 messages
2016/02/05
[#73730] [Ruby trunk Feature#12034] RegExp does not respect file encoding directive — nobu@...
Issue #12034 has been updated by Nobuyoshi Nakada.
3 messages
2016/02/07
[#73746] [Ruby trunk Feature#12034] RegExp does not respect file encoding directive — nobu@...
Issue #12034 has been updated by Nobuyoshi Nakada.
3 messages
2016/02/09
[#73919] [Ruby trunk Feature#11262] Make more objects behave like "Functions" — Ruby-Lang@...
Issue #11262 has been updated by J旦rg W Mittag.
3 messages
2016/02/22
[#74019] [Ruby trunk Bug#12103][Rejected] ruby process hangs while executing regular expression. — duerst@...
Issue #12103 has been updated by Martin D端rst.
3 messages
2016/02/27
[ruby-core:73739] Re: [Ruby trunk Feature#12034] RegExp does not respect file encoding directive
From:
Eric Wong <normalperson@...>
Date:
2016-02-07 23:23:05 UTC
List:
ruby-core #73739
Eric Wong <normalperson@yhbt.net> wrote:
> Returning invalid strings is the main problem, I think;
> and we should stop doing that. Dir.entries and similar methods
> have the same problem.
Maybe this, too:
Subject: [PATCH] string.c (rb_external_str_with_enc): fall back to ASCII-8BIT
Fall back to returning ASCII-8BIT instead of returning invalid
strings for things like Dir.entries.
---
string.c | 4 ++++
test/ruby/test_dir_m17n.rb | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/string.c b/string.c
index e4a02eb..e390dfc 100644
--- a/string.c
+++ b/string.c
@@ -958,6 +958,10 @@ rb_external_str_with_enc(VALUE str, rb_encoding *eenc)
return str;
}
rb_enc_associate(str, eenc);
+ if (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN) {
+ rb_enc_associate(str, rb_ascii8bit_encoding());
+ return str;
+ }
return rb_str_conv_enc(str, eenc, rb_default_internal_encoding());
}
diff --git a/test/ruby/test_dir_m17n.rb b/test/ruby/test_dir_m17n.rb
index febfbc0..db5ac58 100644
--- a/test/ruby/test_dir_m17n.rb
+++ b/test/ruby/test_dir_m17n.rb
@@ -72,7 +72,8 @@ def test_filename_extutf8_invalid
opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
ents = Dir.entries(".", opts)
filename = "%FF" if /darwin/ =~ RUBY_PLATFORM && ents.include?("%FF")
- assert_include(ents, filename)
+ assert_include(ents, filename.b)
+ ents.each { |f| assert_predicate f, :valid_encoding? }
EOS
}
end unless /mswin|mingw/ =~ RUBY_PLATFORM
--
http://80x24.org/spew/20160207232116.15467-1-e%4080x24.org/raw
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>