Domanda

I am trying to enter a long string (> 256 characters but generally < 512) in Ruby with:

puts "Enter long string"
ilogo = gets.chomp
puts "#{ilogo}"

For some silly reason, it always truncates the input to keep only 256 characters (before chomp).
I verified that Ruby accepts longer strings, and that Windows 7 command line console also accepts strings > 256 chars. I can't find any mention of the gets method having that type of limitation, but I am surely missing something. I am clueless. Could that be just a gets limitation?

Edit: Just to be more specific: one of the test strings I am using is:

11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111123456777777777777777777777

Where 6 corresponds to the 256th character. As indicated, the string truncates all characters beyond the 256th.

È stato utile?

Soluzione

The best place to post this bug report is the mailing list Ruby-Talk, http://www.ruby-forum.com/forum/ruby.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top