Skip to content

Instantly share code, notes, and snippets.

@Quintus
Created November 20, 2010 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Quintus/707721 to your computer and use it in GitHub Desktop.
Save Quintus/707721 to your computer and use it in GitHub Desktop.
Sinatra issue 126
$ ruby my_app.rb
== Sinatra/1.1.0 has taken the stage on 3000 for development with backup from Thin
>> Thin web server (v1.2.7 codename No Hup)
>> Maximum connections set to 1024
>> Listening on localhost:3000, CTRL+C to stop
Encoding::CompatibilityError - incompatible character encodings: US-ASCII and ASCII-8BIT:
./views/main.rhtml:9:in `concat'
./views/main.rhtml:9:in `block in singletonclass'
./views/main.rhtml:65531:in `instance_eval'
./views/main.rhtml:65531:in `singletonclass'
./views/main.rhtml:65529:in `__tilt_11d33e3bf6b8524e65dd832031a12c6e'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/tilt-1.1/lib/tilt.rb:192:in `evaluate'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/tilt-1.1/lib/tilt.rb:128:in `render'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:452:in `render'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:362:in `erb'
my_app.rb:19:in `block in <class:MyApp>'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:1033:in `call'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:1033:in `block in compile!'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:620:in `instance_eval'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:620:in `route_eval'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:604:in `block (2 levels) in route!'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:656:in `block in process_route'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:653:in `catch'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:653:in `process_route'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:603:in `block in route!'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:602:in `each'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:602:in `route!'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:741:in `dispatch!'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:530:in `block in call!'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:706:in `instance_eval'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:706:in `block in invoke'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:706:in `catch'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:706:in `invoke'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:530:in `call!'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:516:in `call'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/showexceptions.rb:24:in `call'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/commonlogger.rb:18:in `call'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:1142:in `block in call'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:1168:in `synchronize'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:1142:in `call'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/content_length.rb:13:in `call'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/chunked.rb:15:in `call'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:76:in `block in pre_process'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:74:in `catch'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:74:in `pre_process'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:57:in `process'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:42:in `receive_data'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/backends/base.rb:57:in `start'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/server.rb:156:in `start'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/handler/thin.rb:14:in `run'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:1113:in `run!'
my_app.rb:24:in `<main>'
Encoding::CompatibilityError: incompatible character encodings: US-ASCII and ASCII-8BIT
./views/main.rhtml:9:in `concat'
./views/main.rhtml:9:in `block in singletonclass'
./views/main.rhtml:65531:in `instance_eval'
./views/main.rhtml:65531:in `singletonclass'
./views/main.rhtml:65529:in `__tilt_11d33e3bf6b8524e65dd832031a12c6e'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/tilt-1.1/lib/tilt.rb:192:in `evaluate'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/tilt-1.1/lib/tilt.rb:128:in `render'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:452:in `render'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:362:in `erb'
my_app.rb:19:in `block in <class:MyApp>'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:1033:in `call'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:1033:in `block in compile!'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:620:in `instance_eval'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:620:in `route_eval'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:604:in `block (2 levels) in route!'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:656:in `block in process_route'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:653:in `catch'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:653:in `process_route'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:603:in `block in route!'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:602:in `each'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:602:in `route!'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:741:in `dispatch!'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:530:in `block in call!'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:706:in `instance_eval'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:706:in `block in invoke'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:706:in `catch'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:706:in `invoke'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:530:in `call!'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:516:in `call'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/showexceptions.rb:24:in `call'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/commonlogger.rb:18:in `call'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:1142:in `block in call'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:1168:in `synchronize'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:1142:in `call'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/content_length.rb:13:in `call'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/chunked.rb:15:in `call'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:76:in `block in pre_process'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:74:in `catch'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:74:in `pre_process'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:57:in `process'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:42:in `receive_data'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/backends/base.rb:57:in `start'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/server.rb:156:in `start'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/handler/thin.rb:14:in `run'
/opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:1113:in `run!'
my_app.rb:24:in `<main>'
127.0.0.1 - - [18/Nov/2010 18:25:58] "GET / HTTP/1.1" 500 122504 0.0915
127.0.0.1 - - [18/Nov/2010 18:25:58] "GET /__sinatra__/500.png HTTP/1.1" 304 - 0.0074
^C>> Stopping ...
== Sinatra has ended his set (crowd applauds)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
</head>
<body>
<%= erb :_part %>
<p>Some text with special char ä here</p>
</body>
</html>
#!/usr/bin/env ruby
#Encoding: UTF-8
require "erb"
require "sinatra/base"
class MyApp < Sinatra::Base
set :app_file, __FILE__
set :root, File.dirname(__FILE__)
configure :development do
enable :logging
enable :dump_errors
set :bind, "localhost"
end
get "/" do
erb :main
end
end
MyApp.run! :host => "localhost", :port => 3000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment