Hello, I''m trying to re-use the same demo I used on IronRuby 0.3 however on 0.6 I''m getting the following error: IronRuby::Builtins::EncodingCompatibilityError in Posts#index Showing app/views/posts/index.html.erb where line #12 raised: incompatible character encodings: utf-8 (KCODE) and utf-8 The code does this: <% @posts.each do |p| %> <tr> <td><%= p.Title %></td> </tr> <% end %> p is a Post C# object, Title is a string populated by a C# framework. Please help! Thanks Ben
Have you read the documentation on how to get IronRuby running Rails? http://ironruby.net/Documentation/Real_Ruby_Applications/Rails Here''s the relevant info: 8. Rails by default uses UTF-8 encoding, but IronRuby has issues when mixing this encoding with UTF-8 strings from .NET. For now, you can disable encoding by removing the method body of Rails::Initializer#initialize_encoding in rails-2.3.2\lib\initializer.rb. ________________________________________ From: ironruby-core-bounces at rubyforge.org [ironruby-core-bounces at rubyforge.org] on behalf of Ben Hall [ben2004uk at googlemail.com] Sent: Tuesday, July 14, 2009 10:56 AM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] IronRuby 0.6 and Rails Hello, I''m trying to re-use the same demo I used on IronRuby 0.3 however on 0.6 I''m getting the following error: IronRuby::Builtins::EncodingCompatibilityError in Posts#index Showing app/views/posts/index.html.erb where line #12 raised: incompatible character encodings: utf-8 (KCODE) and utf-8 The code does this: <% @posts.each do |p| %> <tr> <td><%= p.Title %></td> </tr> <% end %> p is a Post C# object, Title is a string populated by a C# framework. Please help! Thanks Ben _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
hmmm, I made the change but now it is erroring around <%= yield %> IronRuby::Builtins::EncodingCompatibilityError in Posts#index Showing app/views/layouts/posts.html.erb where line #15 raised: incompatible character encodings: utf-8 (KCODE) and utf-8 On Tue, Jul 14, 2009 at 8:12 PM, Jimmy Schementi<Jimmy.Schementi at microsoft.com> wrote:> Have you read the documentation on how to get IronRuby running Rails? > http://ironruby.net/Documentation/Real_Ruby_Applications/Rails > > Here''s the relevant info: > 8. Rails by default uses UTF-8 encoding, but IronRuby has issues when mixing this encoding with UTF-8 strings from .NET. For now, you can disable encoding by removing the method body of Rails::Initializer#initialize_encoding in rails-2.3.2\lib\initializer.rb. > ________________________________________ > From: ironruby-core-bounces at rubyforge.org [ironruby-core-bounces at rubyforge.org] on behalf of Ben Hall [ben2004uk at googlemail.com] > Sent: Tuesday, July 14, 2009 10:56 AM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] IronRuby 0.6 and Rails > > Hello, > > I''m trying to re-use the same demo I used on IronRuby 0.3 however on > 0.6 I''m getting the following error: > > IronRuby::Builtins::EncodingCompatibilityError in Posts#index > > Showing app/views/posts/index.html.erb where line #12 raised: > > incompatible character encodings: utf-8 (KCODE) and utf-8 > > The code does this: > <% @posts.each do |p| %> > ?<tr> > ? ?<td><%= p.Title %></td> > ?</tr> > <% end %> > > p is a Post C# object, Title is a string populated by a C# framework. > > Please help! > > Thanks > > Ben > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >
Do a <% puts $KCODE %> or something near the yield (or even in the template that it yields to) to see when KCODE is being set. KCODE will be set if it encounters a utf-8 encoded file. Also, if you can get the demo to me, I''d be more than happy to take a look myself rather than debugging over email. ________________________________________ From: ironruby-core-bounces at rubyforge.org [ironruby-core-bounces at rubyforge.org] on behalf of Ben Hall [ben2004uk at googlemail.com] Sent: Tuesday, July 14, 2009 1:22 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] IronRuby 0.6 and Rails hmmm, I made the change but now it is erroring around <%= yield %> IronRuby::Builtins::EncodingCompatibilityError in Posts#index Showing app/views/layouts/posts.html.erb where line #15 raised: incompatible character encodings: utf-8 (KCODE) and utf-8 On Tue, Jul 14, 2009 at 8:12 PM, Jimmy Schementi<Jimmy.Schementi at microsoft.com> wrote:> Have you read the documentation on how to get IronRuby running Rails? > http://ironruby.net/Documentation/Real_Ruby_Applications/Rails > > Here''s the relevant info: > 8. Rails by default uses UTF-8 encoding, but IronRuby has issues when mixing this encoding with UTF-8 strings from .NET. For now, you can disable encoding by removing the method body of Rails::Initializer#initialize_encoding in rails-2.3.2\lib\initializer.rb. > ________________________________________ > From: ironruby-core-bounces at rubyforge.org [ironruby-core-bounces at rubyforge.org] on behalf of Ben Hall [ben2004uk at googlemail.com] > Sent: Tuesday, July 14, 2009 10:56 AM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] IronRuby 0.6 and Rails > > Hello, > > I''m trying to re-use the same demo I used on IronRuby 0.3 however on > 0.6 I''m getting the following error: > > IronRuby::Builtins::EncodingCompatibilityError in Posts#index > > Showing app/views/posts/index.html.erb where line #12 raised: > > incompatible character encodings: utf-8 (KCODE) and utf-8 > > The code does this: > <% @posts.each do |p| %> > <tr> > <td><%= p.Title %></td> > </tr> > <% end %> > > p is a Post C# object, Title is a string populated by a C# framework. > > Please help! > > Thanks > > Ben > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >_______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core