Hi,

In message "Re: String#length not working properly in Ruby 1.9"
    on Sun, 26 Aug 2007 04:14:17 +0900, "Austin Ziegler" <halostatue / gmail.com> writes:

|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

works as code conversion (from the encoding of the string to utf-8).
In addition, if you have a wrong encoding specified string (i.e. the
data is euc-jp but the specified encoding is utf-8), you can specify
the source encoding explicitly by the second argument:

  str.encode("utf-8", "euc-jp")

							matz.