From: "nagachika (Tomoyuki Chikanaga)" Date: 2013-04-23T23:05:04+09:00 Subject: [ruby-core:54523] [Backport 200 - Backport #8290] String#inspect should not represent NUL as "\0" when octal digits may follow. Issue #8290 has been updated by nagachika (Tomoyuki Chikanaga). Assignee set to nagachika (Tomoyuki Chikanaga) ---------------------------------------- Backport #8290: String#inspect should not represent NUL as "\0" when octal digits may follow. https://bugs.ruby-lang.org/issues/8290#change-38839 Author: knu (Akinori MUSHA) Status: Assigned Priority: Normal Assignee: nagachika (Tomoyuki Chikanaga) Category: Target version: Starting from Ruby 2.0.0, String#inspect represents the NUL character as "\0" but it is not appropriate at least when octal digits follow. Not only is it confusing to human eyes but it also breaks the characteristic of String#inspect that you can "eval" the result to get the original string, though not guaranteed. % ruby -ve 'p "\0"+"12"' # ruby 1.8.7 (2012-10-12 patchlevel 371) [x86_64-freebsd9] "\00012" => OK # ruby 1.9.3p409 (2013-04-04) [x86_64-freebsd9] "\u000012" => OK # ruby 2.0.0p145 (2013-04-17 revision 40339) [x86_64-freebsd9] "\012" => Confusing # ruby 2.1.0dev (2013-04-19 trunk 40366) [x86_64-freebsd9] "\012" => Confusing Attached is a patch that fixes this issue. -- http://bugs.ruby-lang.org/