Bug #1918

inspect Struct.new results incompatible character encodings on non-ascii structure

Added by Heesob Park almost 6 years ago. Updated about 4 years ago.

[ruby-core:24849]
Status:Closed
Priority:Normal
Assignee:-
ruby -v:ruby 1.9.2dev (2009-08-10 trunk 24489) [i686-linux] Backport:

Description

=begin
inspect Struct.new results incompatible character encodings on non-ascii name and member.

$ ruby -e "Résumé = Struct.new(:résumé);p Résumé.new"
-e:1:in inspect': incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)
from -e:1:in
p'
from -e:1:in `'
=end

History

#1 Updated by Frank Cameron almost 6 years ago

=begin

ruby1.9 -e "Résumé = Struct.new(:résumé);p Résumé.new"
-e:1:in inspect': append incompatible encoding strings: ASCII-8BIT and UTF-8 (ArgumentError)
from -e:1:in
p'
from -e:1:in `'
ruby1.9 -e "Résumé = Struct.new(:rsum);p Résumé.new"
#
ruby1.9 -e "Rsum = Struct.new(:résumé);p Rsum.new"
#

struct.c, in inspect_struct:
499 const char *cname = rb_class2name(rb_obj_class(s));
512 str = rb_sprintf("#<struct %s ", cname);
521 slot = RARRAY_PTR(members)[i];
522 id = SYM2ID(slot);
524 rb_str_append(str, rb_id2str(id));
=end

#2 Updated by Nobuyoshi Nakada almost 6 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r24513.
=end

Also available in: Atom PDF