From: J-H Johansen Date: 2011-01-14T02:15:09+09:00 Subject: Re: Weird error using String#[] --0016361e7d089a0f440499bd75a0 Content-Type: text/plain; charset=ISO-8859-1 Hi there, Normally when I see similiar behaviour it's because of "hidden" characters. Do you have a hidden \r (0x0D, decimal 13) in the text you're reading ? On Thu, Jan 13, 2011 at 6:01 PM, Jason Mcdonald wrote: > Thanks, Robert. The original post has the script with both expected and > unexpected outcomes. What you show with the encoding screwing up the > offsets makes total sense. > > What I'm at a loss for is why it affects the hard coded portion of the > string passed to puts: > > Example: > puts "ret: #{ret}" > > Output: > Oet: [part but not all of the expected string - 2 chars too short] > > At this point I plan on using Nokogiri but I am really curious what is > causing what I describe above. This is a weirdness for how strings / > puts works that I'd like to understand and keep in mind going forward. > > Thanks! > > -- > Posted via http://www.ruby-forum.com/. > > -- Jens-Harald Johansen -- There are 10 kinds of people in the world: Those who understand binary and those who don't... --0016361e7d089a0f440499bd75a0--