Ruby 'gets' truncates input to 256 characters (Windows)

Is this a ‘feature’ of Ruby on windows?
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 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 have seen that people
don’t have the issue with MacOS, but others do have it with Windows XP.
I am running Win7. I can’t find any mention of the gets method having
that type of limitation, but I am surely missing something. Could that
be just a ‘gets’ limitation for Ruby running on Windows?

jen Marsh wrote in post #1109409:

Is this a ‘feature’ of Ruby on windows?
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 reason, it always truncates the input to keep only 256
characters (before chomp).

I can’t really help with windows (don’t have it), but as you said, it
doesn’t happen on Mac OS X, nor on Linux, but it seems unlikely that it
would work differently on Windows.
I assume you have checked the actual length of the string, with
ilogo.size ? Just to rule out the possibility that something funny is
going on with the output of long strings in the console window…

Hi,

2013/5/18 jen Marsh [email protected]:

I verified that Ruby accepts longer strings, and that Windows 7 command
line console also accepts strings > 256 chars. I have seen that people
don’t have the issue with MacOS, but others do have it with Windows XP.
I am running Win7. I can’t find any mention of the gets method having
that type of limitation, but I am surely missing something. Could that
be just a ‘gets’ limitation for Ruby running on Windows?

This is a feature of Ruby on Windows.
This undesired feature was raised from change sets which workaround a
bug of ReadFile Win32 API .
Refer to

If you think this is a bug, please make an issue on

Regards,
Park H.

Heesob P. wrote in post #1109447:

If you think this is a bug, please make an issue on
http://bugs.ruby-lang.org

Regards,
Park H.

Thanks, I just submitted a bug report: # 8427.