From: Martin Duerst Date: 2007-12-08T13:01:12+09:00 Subject: Re: Default encoding not set properly Hello Michal, First, can you please fix your mail software so that it sends standard Internet line endings? At 05:21 07/12/08, Michal Suchanek wrote: >Hello, I tried running 1.9 irb, and figure out where the default encoding >is. > >It looks like it is Encoding.default_external. > >However, it is not set >properly when I run irb in luit: > >irb(main):001:0> >Encoding.default_external >=> >irb(main):002:0> `locale` >=> >"LANG=en_US.UTF-8\nLC_CTYPE=\"cs_CZ\"\nLC_NUMERIC=\"cs_CZ\"\nLC_TIME=\"cs_CZ\"\nLC_COLLATE=\"cs_CZ\"\nLC_MONETARY=\"cs_CZ\"\nLC_MESSAGES=\"cs_CZ\"\nLC_PAPER=\"cs_CZ\"\nLC_NAME=\"cs_CZ\"\nLC_ADDRESS=\"cs_CZ\"\nLC_TELEPHONE=\"cs_CZ\"\nLC_MEASUREMENT=\"cs_CZ\"\nLC_IDENTIFICATION=\"cs_CZ\"\nLC_ALL=cs_CZ\n" > >As >I understand it applications should look at LC_CTYPE, LC_ALL, and >LANG (in >this order) Can you point to some source for this information? Also, the only one of these environment variables that contains an encoding is LANG, which says UTF-8, and this is what Ruby took, so I don't see what's wrong. Maybe cs_CZ in your case implies another encoding, and you are expecting this to be picked up, but how should Ruby actually do this? Regards, Martin. >to determine encoding (or more precisely >character handling). >Also ruby does not figure out what exact encoding >the locale uses but I >guess this is because POSIX is braindead. I once >tried to find out myself >but could not get to anything in the system >that would tell me.> >It also >does not set the encoding for STDIN; > > ~/ruby-bin/bin/ruby -KU -e 'puts >`locale`, STDIN.gets.encoding' >譌・譛ャ隱 >LANG=en_US.UTF-8 >LC_CTYPE="en_US.UTF-8" >LC_NUMERIC="en_US.UTF-8" >LC_TIME="en_US.UTF-8" >LC_COLLATE="en_US.UTF-8" >LC_MONETARY="en_US.UTF-8" >LC_MESSAGES="en_US.UTF-8" >LC_PAPER="en_US.UTF-8" >LC_NAME="en_US.UTF-8" >LC_ADDRESS="en_US.UTF-8" >LC_TELEPHONE="en_US.UTF-8" >LC_MEASUREMENT="en_US.UTF-8" >LC_IDENTIFICATION="en_US.UTF-8" >LC_ALL= > > > >Thanks > >Michal #-#-# Martin J. Du"rst, Assoc. Professor, Aoyama Gakuin University #-#-# http://www.sw.it.aoyama.ac.jp mailto:duerst@it.aoyama.ac.jp