From: Ryan Davis Date: 2010-10-21T03:42:46+09:00 Subject: Re: [Mac OS X] from where is coming __CF_USER_TEXT_ENCODING ? On Oct 20, 2010, at 11:10 , Une Bévue wrote: > > from a ruby script if i list the ENV hash i get (between others) : > > __CF_USER_TEXT_ENCODING => 0x1F5:0:1 > > when the script is ran from a user and : > > __CF_USER_TEXT_ENCODING => 0x0:0:1 > > when run via sudo. > > however i have : > imyt% sudo cat /var/root/.CFUserTextEncoding > 0:1% > > imyt% cat ~/.CFUserTextEncoding > 0:1% > > pretty the same. > > could that explain the fact that when running a script via sudo i do > have to force encoding ie : > File.open(MACSOUP_SIGNATURES_FILE,:encoding => "UTF-8") > > and no need for ":encoding => "UTF-8"" when running as user. > > i'm suing : > ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10] please don't sue ruby :P > and notice that in both cases i do have : > LANG => fr_FR.UTF-8 501 % env | grep CF __CF_USER_TEXT_ENCODING=0x1F8:0:0 502 % ls -l ~/.CF* ls: /Users/ryan/.CF*: No such file or directory I'm set for English env in System Prefs on OSX so I was a bit surprised to see the env var. "CF" is a prefix that stands for "Core Foundation", aka the bottom layer of cocoa... so you may want to fire up xcode's lovely help system and search around there.