summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-07-24 14:24:18 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-07-24 14:31:41 +0900
commiteec45a93effe69a821960839760b9e39be1ebc63 (patch)
tree0f3ab0bab09728300ecd9ffcef6179d9ce6f9661 /string.c
parent8cc18703cfa7ff88b6ca51267e557fa2658a78fb (diff)
Escape unprintable chars only, without surrounding quotes
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4676
Diffstat (limited to 'string.c')
-rw-r--r--string.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/string.c b/string.c
index 864fcc8791..0d6b02b1dd 100644
--- a/string.c
+++ b/string.c
@@ -11050,7 +11050,7 @@ rb_str_quote_unprintable(VALUE str)
len = RSTRING_LEN(str);
if ((resenc != enc && !rb_str_is_ascii_only_p(str)) ||
!sym_printable(ptr, ptr + len, enc)) {
- return rb_str_inspect(str);
+ return rb_str_escape(str);
}
return str;
}
@@ -11060,7 +11060,7 @@ rb_id_quote_unprintable(ID id)
{
VALUE str = rb_id2str(id);
if (!rb_str_symname_p(str)) {
- return rb_str_inspect(str);
+ return rb_str_escape(str);
}
return str;
}