public
Last active

Sinatra issue 126

  • Download Gist
_part.rhtml
RHTML
1
<p>ä</p>
error.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
$ 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)
main.rhtml
RHTML
1 2 3 4 5 6 7 8 9 10 11 12
<!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>
my_app.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#!/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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.