From: Florian Gross Date: 2007-09-02T05:03:07+09:00 Subject: Re: String#length not working properly in Ruby 1.9 On Aug 27, 4:52 am, Yukihiro Matsumoto wrote: > |So, can a string's encoding be changed once it's initially set, or > |will it be set only by specifying the encoding on read or write? > > You can. If a string is a binary (raw) string, you can > > str.encode("utf-8") # specify encoding without conversion > > to specify encoding. If a string has encoding specified, > > str.encode("utf-8") # convert from str.encoding to utf-8 Hm, does this return a new string with the supplied encoding (non- destructive behaviour) or does it change the encoding in-place? Just wondering.