mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 20:44:20 +00:00
27 lines
387 B
Plaintext
27 lines
387 B
Plaintext
# English text with newlines.
|
|
text = <<~EOT
|
|
First line
|
|
Second line
|
|
|
|
Fourth line
|
|
Fifth line
|
|
EOT
|
|
|
|
# Japanese text.
|
|
japanese = 'こんにちは'
|
|
|
|
# Binary data.
|
|
data = "\u9990\u9991\u9992\u9993\u9994"
|
|
|
|
# Text file.
|
|
File.write('t.txt', text)
|
|
|
|
# File with Japanese text.
|
|
File.write('t.ja', japanese)
|
|
|
|
# File with binary data.
|
|
f = File.new('t.dat', 'wb:UTF-16')
|
|
f.write(data)
|
|
f.close
|
|
|