Maxim Maslov
2009-Aug-20 15:48 UTC
[Ironruby-core] Time.now and System::Text::EncoderFallbackException
Hi all, I''ve got a strange problem with Time.now (and System.DateTime.Now, of course) when the current culture is set to ''ru-RU'', ''pl-PL'' or some other cultures: V:\PROGS\Ruby\Migrate\ClearQuest>D:\Progs\Ruby\IronRuby-0.9.0\bin\ir.exe IronRuby 0.9.0.0 on .NET 2.0.50727.3082 Copyright (c) Microsoft Corporation. All rights reserved.>>> include System::Globalization=> Object>>> include System::Threading=> Object>>> Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(''ru-RU'') => ru-RU>>> Time.now=> mscorlib:0:in `GetBytes'': Value does not fall within the expected range. (Sys tem::Text::EncoderFallbackException) from mscorlib:0:in `GetBytes'' from :0 Can anybody help? Thanks, Maxim Maslov -- Posted via http://www.ruby-forum.com/.
Tomas Matousek
2009-Aug-20 16:28 UTC
[Ironruby-core] Time.now and System::Text::EncoderFallbackException
DataTime.inspect is supposed to use invariant culture for formatting the time. I think I''ve fixed this recently. Can you try the latest build?>>> Time.now=> Thu Aug 20 09:19:50 -07:00 2009 As a workaround you can do Time.now.ToString(''hh mm ss, MMM yyyy'') for example. Note that MRI 1.8 doesn''t support encoded strings well. We are trying to make them work but we haven''t fixed all Ruby string manipulating methods yet. Everything should just work if you use CLR strings. Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Maxim Maslov Sent: Thursday, August 20, 2009 8:49 AM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Time.now and System::Text::EncoderFallbackException Hi all, I''ve got a strange problem with Time.now (and System.DateTime.Now, of course) when the current culture is set to ''ru-RU'', ''pl-PL'' or some other cultures: V:\PROGS\Ruby\Migrate\ClearQuest>D:\Progs\Ruby\IronRuby-0.9.0\bin\ir.exe IronRuby 0.9.0.0 on .NET 2.0.50727.3082 Copyright (c) Microsoft Corporation. All rights reserved.>>> include System::Globalization=> Object>>> include System::Threading=> Object>>> Thread.CurrentThread.CurrentCulture >>> CultureInfo.CreateSpecificCulture(''ru-RU'') => ru-RU>>> Time.now=> mscorlib:0:in `GetBytes'': Value does not fall within the expected range. (Sys tem::Text::EncoderFallbackException) from mscorlib:0:in `GetBytes'' from :0 Can anybody help? Thanks, Maxim Maslov -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core