From: Yukihiro Matsumoto Date: 2006-06-27T16:45:32+09:00 Subject: Re: Unicode roadmap? Hi, In message "Re: Unicode roadmap?" on Tue, 27 Jun 2006 06:52:14 +0900, "Austin Ziegler" writes: |> Austin Ziegler wrote: |> > d1 = File.open("file.txt", "rb", encoding: :utf8) { |f| f.read } |> Question: Does the encoding parameter specify the encoding of the file, |> or the encoding of the strings you get back (my guess is both). | |I would assume both, based on what I've seen from Matz. I think so. |> Another Question: When you set the encoding, are you: |> |> (A) Just changing the encoding specifier without changing the |> underlaying string. |> (B) Re-encoding the string according to the new encoding specifier. | |> (B) seems to be implied by the attribute notation, but that seems a bit |> dangerous in my mind. | |I personally consider it to be (A) because I believe that encoding is |a lens. If you want (B) it should be s1.recode(:utf8). But #recode |would not work on an encoding of "binary" (or "raw"); #recode would be |similar to the Iconv steps you would use today. str.encoding="ascii" would cause (A). matz.