Warning: regexp match /./n against to UTF-8 string

[Rails 3.2.3 / Ruby 1.9.3 I18n.locale :fr … => accentuated
characters => need UTF-8)

It’s very annoying that I need to place an ’ # encoding: utf-8’ at
the beginning of most of my Rails script files …
I can understand when using strings w accentuated characters in yaml
files, but I just found another scenario in which I also had to insert
it at the beginning of a model script file …

I have a Partner model :

class Partner < ActiveRecord::Base
belongs_to :area

attr_accessor :location
validates :location, :location => { :unless => Proc.new { |p|
p.location.blank? } }

with a LocationValidator ( validating the location with Google via
the Geocoder gem … )
during my tests I placed a puts command to check the value before
calling the GeoCoder… as this value is auto-generated w Faker gem
.
class LocationValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
puts “location: #{value}”
results = Geocoder.search(value)

running the test , I got a warning in the console

…/.rvm/gems/ruby-1.9.3-p125@rails32/gems/activesupport-3.2.3/lib/active_support/multibyte/chars.rb:59:
warning: regexp match /…/n against to UTF-8 string
location: 62, Chemin Albrecht Altdorfer ,72120 ,vaill ,France

I inserted ’ # encoding: utf-8’ in my location validator
script … wo any change , so
I inserted also ’ # encoding: utf-8’ in my Partner model script et
voil, the warning doesn’t display in the console…

It seems that we need to place ’ # encoding: utf-8’ everywhere
when using UTF-8 … which is the default …
I have in my environment.rb
Encoding.default_external = “UTF-8”
Encoding.default_internal = “UTF-8”

and in my application.rb
config.encoding = “utf-8”

Is there any clear recommendation when using UTF-8 that could avoid me
to insert ’ # encoding: utf-8’ everywhere ?

feedback welcome

[SOLVED] not related to UTF-8 , but rather to a script in my lib
performing a wrong transliteration

value = aString.mb_chars.normalize(:kd).gsub(/[^\x00-\x7F]/n,
‘’).to_s # replace non-ASCII
this is not needed anymore, using Rails 3 I can replace accentuated
characters with : name.parameterize