------ art_13009_786331.1193032898858 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline if use wxruby can solve my problem, example: require 'wx' puts Wx::Locale.get_system_encoding_name this code will output 'cp936' on my windows and output 'UTF8' on my linux. but it need wxruby, i want to know how to implement same function without wxruby, thanks. On 10/22/07, Austin Ziegler <halostatue / gmail.com> wrote: > > On 10/22/07, venture Lee <liwenqiu / gmail.com> wrote: > > hi,all: > > I have a problem, I don't know how to find out what is the current > > local encoding by ruby script, My script must can be run on windows or > > linux platform. > > who can tell me how to do, thanks very much. > > There's no cross-platform way of telling this. LC_LANG will tell you > some things (not always truthfully or usefully, since it can change) > on Linux. I'm not sure that there's an easy way to get what you want > from Ruby on Windows, as Ruby scripts run under the console (ruby.exe) > might return different values than Ruby scripts run without a console > (rubyw.exe), and you'd need a Win32API call. > > You're probably better of reformulating what you want. > > -austin > -- > Austin Ziegler * halostatue / gmail.com * http://www.halostatue.ca/ > * austin / halostatue.ca * http://www.halostatue.ca/feed/ > * austin / zieglers.ca > > ------ art_13009_786331.1193032898858--