From: "hsbt (Hiroshi SHIBATA) via ruby-core" Date: 2024-01-17T01:17:02+00:00 Subject: [ruby-core:116260] [Ruby master Bug#20185] String#ascii_only? buggy in ruby 3.3 Issue #20185 has been updated by hsbt (Hiroshi SHIBATA). No, `Fix https://bugs.ruby-lang.org/issues/20185`of commit message is not correct format for redmine autolink. ---------------------------------------- Bug #20185: String#ascii_only? buggy in ruby 3.3 https://bugs.ruby-lang.org/issues/20185#change-106281 * Author: chucke (Tiago Cardoso) * Status: Closed * Priority: Normal * ruby -v: 3.3.0 * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- This was the smallest reduction of the bug I could come up with: require "stringio" puts StringIO::VERSION def is_ascii(buffer) str = buffer.string puts "\"#{str}\" is ascii: #{str.ascii_only?}" end buffer = StringIO.new("".b) buffer.write("a=b&c=d") buffer.rewind is_ascii(buffer) buffer.write "����������" is_ascii(buffer) # in ruby 3.3 #=> 3.1.0 #=> "a=b&c=d" is ascii: true #=> "����������" is ascii: true # in ruby 3.2 #=> 3.0.4 #=> "a=b&c=d" is ascii: true #=> "����������" is ascii: true # in ruby 3.1 #=> 3.0.1 #=> "a=b&c=d" is ascii: true #=> "����������" is ascii: false I believe that only the 3.1 result is correct, as "����������" first character is not ascii. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/