ruby on rails - Encoding differences from active record to view -


the special characters come server not rendered right, ones in static text in html rendered ok.

i have record in dev base. it's title 'légende'.

[1] pry(main)> record.last.title   record load (0.3ms)  select  "records".* "records"  order "records"."id" desc limit 1 => "légende" [2] pry(main)> record.last.title.encoding   record load (0.2ms)  select  "records".* "records"  order "records"."id" desc limit 1 => #<encoding:utf-8> 

when want #show in view, prints le‘gende. it's not usual encoding problem, because doesn't print &eacute; or é.

plus, if copy , paste le‘gende web page, becomes légende again. it's weird.

records#show

  def show     @record = record.find(params[:id])   end 

show.html.erb

<h1>bibliothèque</h1> <h2><%= @record.title %></h2> 

config/application.rb

config.i18n.default_locale = :fr config.encoding = "utf-8" 

layout/application.html.erb

  <meta http-equiv="content-type" content="text/html; charset=utf-8" />   <meta charset="utf-8"> 

application_controller.rb

class applicationcontroller < actioncontroller::base   # encoding: utf-8    protect_from_forgery with: :exception end 

i don't know go here.

it font problem.

for future reference : culprit open sans.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -