From: Vladimir Sizikov Date: 2008-06-04T19:04:02+09:00 Subject: Re: [PATCH] Iconv#iconv(str, start, length) doesn't really convert str[start, length] Hi, So, this is clearly a backwards-incompatible change, since all Ruby versions up to the revision with the patch, treat second argument as an index, that's how Iconv#iconv was always working (despite the documentation stating otherwise). In fact, we have RubySpec tests for this behavior, since that was de-facto behavior. I'm not really saying that the change is bad/wrong, but I"m saying that every incompatible change *is* incompatible change and somehow needs to be better documented and with tests enforcing that behavior. Also, what would happen with 1.8.6/1.8.7 lines, will they get the update, or will they continue to exhibit current behavior? You see, any incompatible changes quickly lead to very messy situations. If somebody is relying on older behavior, they will get *silent* , hidden errors when upgrading. Maybe, only docs need to be changed to match the current de-facto behavor, rather than vice versa? Thanks, --Vladimir On Wed, Jun 4, 2008 at 8:39 AM, Vincent wrote: > Hi, > > Here is a patch that handles both argument check and default value. > ChangeLog: > > * ext/iconv/iconv.c : Iconv#iconv's length parameter default value changed > to nil, which means to the end of the string. Any negative length, including -1, > makes iconv return "". > * iconv_convert : treats length as conversion length rather than an end index > to match String#[fixnum, fixnum]. > > Thanks, > Vincent >