From: unbewusst.sein@... (=?ISO-8859-1?Q?Une_B=E9vue?=) Date: 2010-03-12T01:40:21+09:00 Subject: Re: reading an UTF-8 encoded file Brian Candler wrote: > If forcing the encoding of individual strings makes Ruby output them > differently, then I expect that STDOUT must have an external encoding > set. > > Try this: > > p STDOUT.external_encoding > > What do you get? If you get something other than nil, it means that puts > will transcode characters from the tagged encoding to this encoding. I got nil )) > In ruby 1.9, STDOUT.external_encoding is nil unless you set it > explicitly. > > >> STDOUT.external_encoding > => nil > >> Encoding.default_external > => # > >> RUBY_DESCRIPTION > => "ruby 1.9.2dev (2009-07-18 trunk 24186) [i686-linux]" > > Perhaps the version of 1.9.0 which macruby forked from was different in > this regard though. yes right, I'll ask to the MacRuby list. In fact, i do have also a buitin ruby 1.8.x but i'd rather make use of 1.9 because i do have to count UTF-8 chars and i know this is internal with ruby 1.9 and because i might design an UI it's better using MacRuby because it is written on top of Obj-C and Cocoa. -- � L'essence m�me du g�nie, c'est de mettre en pratique les id�es les plus simples. � (Charles Peguy)