From: Brian Candler Date: 2009-07-21T22:43:06+09:00 Subject: Re: Byte–stream parsing in Ruby Elliott Cable wrote: > The goal is to devise some method by which I can: > > 1) Determine whether or not an `Array` of so–far–received bytes is, yet, > a valid `String` of a given `Encoding` >> "über".bytes.to_a => [195, 188, 98, 101, 114] >> a = "\xc3".force_encoding("UTF-8") => "\xC3" >> a.valid_encoding? => false >> a << "\xbc" => "ü" >> a.valid_encoding? => true >> -- Posted via http://www.ruby-forum.com/.