rtomayko/tilt — Issue #114: Severe Problem: incompatible character encodings: ASCII-8BIT and UTF-8
Author: solars
Created: 2011-11-07 12:22:31+00:00
State: open

Hi,

I've got a severe problem and I don't know what to try else.
Having a sinatra app that has a line: xml.html_content erb(:confirmation)

I'm getting with this line:

<%= @res.property.name %>

the error:

./views/confirmation.erb:172:in `evaluate_source'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/tilt-1.3.2/lib/tilt/template.rb:209:in `instance_eval'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/tilt-1.3.2/lib/tilt/template.rb:209:in `evaluate_source'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/tilt-1.3.2/lib/tilt/template.rb:144:in `cached_evaluate'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/tilt-1.3.2/lib/tilt/template.rb:127:in `evaluate'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/tilt-1.3.2/lib/tilt/template.rb:76:in `render'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:563:in `render'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:455:in `erb'
/home/deployer/reservation-templates/releases/20111107114614/helpers.rb:258:in `block (2 levels) in render_email'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/nokogiri-1.4.4/lib/nokogiri/xml/builder.rb:366:in `call'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/nokogiri-1.4.4/lib/nokogiri/xml/builder.rb:366:in `insert'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/nokogiri-1.4.4/lib/nokogiri/xml/builder.rb:350:in `method_missing'
/home/deployer/reservation-templates/releases/20111107114614/helpers.rb:247:in `block in render_email'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/nokogiri-1.4.4/lib/nokogiri/xml/builder.rb:293:in `initialize'
/home/deployer/reservation-templates/releases/20111107114614/helpers.rb:246:in `new'
/home/deployer/reservation-templates/releases/20111107114614/helpers.rb:246:in `render_email'
/home/deployer/reservation-templates/releases/20111107114614/app.rb:152:in `block in '
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:1152:in `call'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:1152:in `block in compile!'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:724:in `instance_eval'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:724:in `route_eval'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:708:in `block (2 levels) in route!'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:758:in `block in process_route'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:755:in `catch'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:755:in `process_route'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:707:in `block in route!'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:706:in `each'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:706:in `route!'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:843:in `dispatch!'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:644:in `block in call!'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:808:in `instance_eval'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:808:in `block in invoke'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:808:in `catch'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:808:in `invoke'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:644:in `call!'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:629:in `call'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/rack-1.3.5/lib/rack/head.rb:9:in `call'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/rack-1.3.5/lib/rack/urlmap.rb:52:in `block in call'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/rack-1.3.5/lib/rack/urlmap.rb:46:in `each'
/home/deployer/reservation-templates/shared/bundle/ruby/1.9.1/gems/rack-1.3.5/lib/rack/urlmap.rb:46:in `call'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb:205:in `start_request_handler'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb:170:in `block in handle_spawn_application'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/utils.rb:479:in `safe_fork'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb:165:in `handle_spawn_application'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:180:in `start'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb:128:in `start'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
:10:in `synchronize'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.9/helper-scripts/passenger-spawn-server:99:in `

'

However,

log.info @res.property.name.encoding
outputs 'UTF-8'

whats the problem here, I don't get it?

I also have the 'magic comment' in the erb file, as well as this:
# encoding: utf-8
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8

in the .rb file

can anyone please help me? I'm desperate :(