Project

General

Profile

Feature #12419

Improve String#dump for Unicode output (from "\u{130}" to "\u0130")

Added by duerst (Martin Dürst) over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:75701]

Description

Currently, "İİİ".dump produces "\u{130}\u{130}\u{130}".

This is rather suboptimal, "\u0130\u0130\u0130" is shorter and easier to read.

The only time \u{} notation should be used is when more than four hex digits are needed.


Related issues

Related to Ruby master - Feature #12275: String unescapeClosedActions

Associated revisions

Revision c6692d94
Added by duerst (Martin Dürst) over 3 years ago

  • string.c (String#dump): Change escaping of non-ASCII characters in UTF-8 to use upper-case four-digit hexadecimal escapes without braces where possible [Feature #12419].
  • test/ruby/test_string.rb (test_dump): Add tests for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 55728
Added by duerst (Martin Dürst) over 3 years ago

  • string.c (String#dump): Change escaping of non-ASCII characters in UTF-8 to use upper-case four-digit hexadecimal escapes without braces where possible [Feature #12419].
  • test/ruby/test_string.rb (test_dump): Add tests for above.

Revision 55728
Added by duerst (Martin Dürst) over 3 years ago

  • string.c (String#dump): Change escaping of non-ASCII characters in UTF-8 to use upper-case four-digit hexadecimal escapes without braces where possible [Feature #12419].
  • test/ruby/test_string.rb (test_dump): Add tests for above.

Revision 55728
Added by duerst (Martin Dürst) over 3 years ago

  • string.c (String#dump): Change escaping of non-ASCII characters in UTF-8 to use upper-case four-digit hexadecimal escapes without braces where possible [Feature #12419].
  • test/ruby/test_string.rb (test_dump): Add tests for above.

Revision 55728
Added by duerst (Martin Dürst) over 3 years ago

  • string.c (String#dump): Change escaping of non-ASCII characters in UTF-8 to use upper-case four-digit hexadecimal escapes without braces where possible [Feature #12419].
  • test/ruby/test_string.rb (test_dump): Add tests for above.

History

Updated by duerst (Martin Dürst) over 3 years ago

  • Assignee set to hsbt (Hiroshi SHIBATA)

Updated by duerst (Martin Dürst) over 3 years ago

  • Assignee changed from hsbt (Hiroshi SHIBATA) to duerst (Martin Dürst)
#4

Updated by duerst (Martin Dürst) over 3 years ago

#5

Updated by duerst (Martin Dürst) over 3 years ago

  • Status changed from Open to Closed

Applied in changeset r55728.


  • string.c (String#dump): Change escaping of non-ASCII characters in UTF-8 to use upper-case four-digit hexadecimal escapes without braces where possible [Feature #12419].
  • test/ruby/test_string.rb (test_dump): Add tests for above.

Also available in: Atom PDF