On Sep 27, 2006, at 2:27 AM, Pete Yandell wrote:
>
> As I said in an earlier email, the laundry list reads something like:
> - Make sure your database character set is utf8 <- this should
> possibly be checked by Rails

Like someone said before, setting your database encoding to utf-8 is  
only important if you want to do string operations. Otherwise you can  
just use the database as a bitbucket and it won't matter. I think  
this this should be the default in railties and not handled by a plugin.

> - Make sure all your tables have a character set of utf8 <- this
> should be done in migrations

The best solution is to set the default encoding of the database when  
you create it, that way you can't miss a table and you still have the  
option to override it for certain tables.

> - Make sure your database.yml has 'encoding: utf8' set for each  
> database

Again, I think this a matter of defaults in Rails.

> - Put $KCODE='u' in your environment.rb

This should probably be a default in environment.rb if we want Rails  
to be completely utf-8.

> - Add 'normalize_unicode_params :form => :kc' to your application.rb

Compatability normalization should _never_ be a default, because it  
causes data loss. If there is a default, it should probably be NFC or  
NFD. I'm still not convinced it's important to normalize all incoming  
data.

> I'll sit down next week and write a plugin that does all this (if
> someone doesn't beat me to it).

The plugin that defines normalize_unicode_params is called  
utf8_plugin and it's in the same repository as the rest of Multibyte  
for Rails stuff. It was meant as a plugin to do all the utf-8  
settings and operations you need to do utf-8 in a Rails application.

The plugin is a descendant of unicode_hacks and in the past this also  
set the database client encoding and the content-type header. We feel  
this is no longer necessary, we this it's better to solve this with  
good defaults and documentation. Thijs van der Vossen is currently  
writing a series of blog posts on our weblog about which steps you  
have to take to have a fully utf-8 Rails, we hope to convert this to  
documentation in the near future.

I am in no way trying to stop you from writing your own plugin, but I  
hope you don't waste time going down the same route we did.

Manfred

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core
-~----------~----~----~----~------~----~------~--~---

Reply via email to