Hi,
In message "[ruby-talk:16250] Encodings"
on 01/06/06, Johan Dahl <Johan.Dahl / ling.lu.se> writes:
|Hi all. I know ruby has some support for some Japanese encodings if you
|compile it in a special way. But are there any plans for a wider
|support for different encodings. I very much like the way you can
|just set an encoding on any io-stream in Tcl/Tk. This is especially
|handy for me who work in an environment with three different
|platforms, Macintosh, Windows and unix.
Yes, there's a plan, even prototype already. You can fetch it from
ruby_m17n branch from CVS repositry.
f = open("file-in-utf8")
f.encoding = "utf-8"
s = f.readline
puts s.encoding # utf-8
puts s[0] # print code of first character (not byte)
f.close
matz.