String length difference between ruby 1.8 and 1.9
Posted
by
Raghu
on Stack Overflow
See other posts from Stack Overflow
or by Raghu
Published on 2012-10-12T21:02:47Z
Indexed on
2012/10/12
21:37 UTC
Read the original article
Hit count: 844
I have a website thats running on ruby 1.8.7 . I have a validation on an incoming post that checks to make sure that we allow upto max of 12000 characters. The spaces are counted as characters and tab and carriage returns are stripped off before the post is subjected to the validation.
Here is the post that is subjected to validation http://pastie.org/5047582
In ruby 1.9 the string length shows up as 11909 which is correct. But when I check the length on ruby 1.8.7 is turns out to be 12044.
I used codepad.org to run this ruby code which gives me http://codepad.org/OxgSuKGZ ( which outputs the length as 12044 which is wrong) but when i run this same code in the console at codeacademy.org the string length is 11909.
Can anybody explain me why this is happening ???
Thanks
© Stack Overflow or respective owner