Bug #8496 ยป 0001-string.c-String-b-Check-the-code-range-so-ascii_only.patch
| ChangeLog | ||
|---|---|---|
|
Wed Jun 5 21:20:11 2013 Akinori MUSHA <knu@iDaemons.org>
|
||
|
* string.c (String#b): Check the code range so ascii_only? on a
|
||
|
result string returns the correct value.
|
||
|
Wed Jun 5 09:46:46 2013 NARUSE, Yui <naruse@ruby-lang.org>
|
||
|
* test/fileutils/test_fileutils.rb (TestFileUtils#test_mkdir): add
|
||
| string.c | ||
|---|---|---|
|
rb_str_b(VALUE str)
|
||
|
{
|
||
|
VALUE str2 = str_alloc(rb_cString);
|
||
|
int cr;
|
||
|
str_replace_shared_without_enc(str2, str);
|
||
|
OBJ_INFECT(str2, str);
|
||
|
ENC_CODERANGE_SET(str2, ENC_CODERANGE_VALID);
|
||
|
cr = coderange_scan(RSTRING_PTR(str2), RSTRING_LEN(str2), 0);
|
||
|
ENC_CODERANGE_SET(str2, cr);
|
||
|
return str2;
|
||
|
}
|
||
| test/ruby/test_m17n.rb | ||
|---|---|---|
|
assert_equal(true, s.b.tainted?)
|
||
|
s.untrust
|
||
|
assert_equal(true, s.b.untrusted?)
|
||
|
s = "abc".b
|
||
|
assert_equal(true, s.b.ascii_only?)
|
||
|
end
|
||
|
def test_scrub
|
||