Ruby on Rails 3, incompatible character encodings: UTF-8 and ASCII-8BIT with i18n -
i've got troubles couple rails 3.0.1, ruby 1.9.2 , website localization.
the problem quite simple, i've got in view :
f.input :zip_code, :label => i18n.t('labels.zip_code')
and es.yml file :
es: labels: zip_code: "este código postal no es valido."
there no troubles en.yml file (it's pure ascii) when website set i18n.locale == 'es'
error :
incompatible character encodings: utf-8 , ascii-8bit
i have been looking around quite while didn't found way use utf-8 translation files.
did knows how make works ?
thanks help.
ok problem solved after hours of googling...
there 2 bugs in code. first 1 file encoding error , second problem mysql data base configuration.
first, solve error caused mysql used 2 articles :
http://www.dotkam.com/2008/09/14/configure-rails-and-mysql-to-support-utf-8/
http://www.rorra.com.ar/2010/07/30/rails-3-mysql-and-utf-8/
second, solve file encoding problem added these 2 lines in config/environment.rb
encoding.default_external = encoding::utf_8 encoding.default_internal = encoding::utf_8
hopefully :)
Comments
Post a Comment