From: Eric Wong Date: 2016-01-25T06:39:16+00:00 Subject: [ruby-core:73401] Re: [Ruby trunk - Feature #12016] [Open] More informative error message when Symbol encoding is invalid alexinbeijing@gmail.com wrote: > Feature #12016: More informative error message when Symbol encoding is invalid > https://bugs.ruby-lang.org/issues/12016 Calling RSTRING_PTR on any function return value directly is dangerous because of GC. PRI*VALUE format strings were introduced to help make avoiding this danger easier, and the '+' modifier will call inspect for you. How about the following? rb_raise(rb_eEncodingError, "encoding %s is invalid for symbol :%+"PRIsVALUE, rb_enc_name(rb_enc_get(str)), str); (also wrapping at 80 cols, some of us use big fonts) Unsubscribe: