File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
src/main/ruby/core/truffle Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ New features:
55
55
* Fixed error when using arrows keys first within ` irb ` or ` pry ` (#1478 , #1486 ).
56
56
* Fixed ` String#inspect ` when the string uses a non-UTF-8 ASCII-compatible
57
57
encoding and has non-ASCII characters.
58
+ * Fixed ` puts ` for strings with non-ASCII-compatible encodings.
58
59
59
60
Changes:
60
61
Original file line number Diff line number Diff line change @@ -52,9 +52,16 @@ def self.puts(io, *args)
52
52
end
53
53
54
54
if str
55
- # Truffle: write the string + record separator (\n) atomically so multithreaded #puts is bearable
56
- unless str . end_with? ( DEFAULT_RECORD_SEPARATOR )
57
- str += DEFAULT_RECORD_SEPARATOR
55
+ # Truffle: write the string + record separator (\n) atomically so multi-threaded #puts is bearable
56
+ if str . encoding . ascii_compatible?
57
+ unless str . end_with? ( DEFAULT_RECORD_SEPARATOR )
58
+ str += DEFAULT_RECORD_SEPARATOR
59
+ end
60
+ else
61
+ rs = DEFAULT_RECORD_SEPARATOR . encode ( str . encoding )
62
+ unless str . end_with? ( rs )
63
+ str += rs
64
+ end
58
65
end
59
66
io . write str
60
67
end
You can’t perform that action at this time.
0 commit comments