{"action":"created","issue":{"url":"https://api.github.com/repos/boazsegev/plezi/issues/17","repository_url":"https://api.github.com/repos/boazsegev/plezi","labels_url":"https://api.github.com/repos/boazsegev/plezi/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/boazsegev/plezi/issues/17/comments","events_url":"https://api.github.com/repos/boazsegev/plezi/issues/17/events","html_url":"https://github.com/boazsegev/plezi/issues/17","id":131421206,"number":17,"title":"ERROR -- : incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)","user":{"login":"davidjuin0519","id":8275168,"avatar_url":"https://avatars.githubusercontent.com/u/8275168?v=3","gravatar_id":"","url":"https://api.github.com/users/davidjuin0519","html_url":"https://github.com/davidjuin0519","followers_url":"https://api.github.com/users/davidjuin0519/followers","following_url":"https://api.github.com/users/davidjuin0519/following{/other_user}","gists_url":"https://api.github.com/users/davidjuin0519/gists{/gist_id}","starred_url":"https://api.github.com/users/davidjuin0519/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidjuin0519/subscriptions","organizations_url":"https://api.github.com/users/davidjuin0519/orgs","repos_url":"https://api.github.com/users/davidjuin0519/repos","events_url":"https://api.github.com/users/davidjuin0519/events{/privacy}","received_events_url":"https://api.github.com/users/davidjuin0519/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-04T17:40:47Z","updated_at":"2016-02-05T02:13:16Z","closed_at":null,"body":"Hi Bo, \r\nWhen I was trying to render chinese character from db, this error always pops out:\r\n```\r\nE, [2016-02-04T17:30:09.803387 #3] ERROR -- : incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)\r\n2016-02-04T17:31:51.954972+00:00 app[web.1]: (erb):241:in `concat'\r\n2016-02-04T17:31:51.954972+00:00 app[web.1]: (erb):241:in `render'\r\n2016-02-04T17:31:51.954973+00:00 app[web.1]: /app/vendor/ruby-2.2.3/lib/ruby/2.2.0/erb.rb:863:in `eval'\r\n2016-02-04T17:31:51.954973+00:00 app[web.1]: /app/vendor/ruby-2.2.3/lib/ruby/2.2.0/erb.rb:863:in `result'\r\n2016-02-04T17:31:51.954975+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/plezi-0.12.21/lib/plezi/common/renderer.rb:119:in `block in <module:Plezi>'\r\n2016-02-04T17:31:51.954975+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/plezi-0.12.21/lib/plezi/common/renderer.rb:36:in `call'\r\n2016-02-04T17:31:51.954976+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/plezi-0.12.21/lib/plezi/common/renderer.rb:36:in `block in render'\r\n2016-02-04T17:31:51.954977+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/plezi-0.12.21/lib/plezi/common/renderer.rb:36:in `each'\r\n2016-02-04T17:31:51.954978+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/plezi-0.12.21/lib/plezi/common/renderer.rb:36:in `render'\r\n2016-02-04T17:31:51.954978+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/plezi-0.12.21/lib/plezi/handlers/controller_magic.rb:196:in `render'\r\n2016-02-04T17:31:51.954979+00:00 app[web.1]: /app/config/initializers/websocket.rb:32:in `index'\r\n2016-02-04T17:31:51.954980+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/plezi-0.12.21/lib/plezi/handlers/controller_core.rb:88:in `_route_path_to_methods_and_set_the_response_'\r\n2016-02-04T17:31:51.954980+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/plezi-0.12.21/lib/plezi/handlers/route.rb:23:in `on_request'\r\n2016-02-04T17:31:51.954981+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/plezi-0.12.21/lib/plezi/handlers/http_router.rb:84:in `block in call'\r\n2016-02-04T17:31:51.954982+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/plezi-0.12.21/lib/plezi/handlers/http_router.rb:84:in `each'\r\n2016-02-04T17:31:51.954982+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/plezi-0.12.21/lib/plezi/handlers/http_router.rb:84:in `call'\r\n2016-02-04T17:31:51.954983+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/iodine-0.1.21/lib/iodine/http/rack_support.rb:19:in `call'\r\n2016-02-04T17:31:51.954983+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/iodine-0.1.21/lib/iodine/http/http1.rb:187:in `dispatch'\r\n2016-02-04T17:31:51.954984+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/iodine-0.1.21/lib/iodine/http/http1.rb:97:in `on_message'\r\n2016-02-04T17:31:51.954985+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/iodine-0.1.21/lib/iodine/protocol.rb:188:in `call'\r\n2016-02-04T17:31:51.954986+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/iodine-0.1.21/lib/iodine/core.rb:65:in `work'\r\n2016-02-04T17:31:51.954986+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/iodine-0.1.21/lib/iodine/core.rb:55:in `cycle'\r\n2016-02-04T17:31:51.954987+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/iodine-0.1.21/lib/iodine/core.rb:75:in `block (2 levels) in startup'\r\n```\r\nI am pretty sure that the string is encoded in UTF-8...I got no idea why this error occur...\r\nDo you have any idea?"},"comment":{"url":"https://api.github.com/repos/boazsegev/plezi/issues/comments/180158770","html_url":"https://github.com/boazsegev/plezi/issues/17#issuecomment-180158770","issue_url":"https://api.github.com/repos/boazsegev/plezi/issues/17","id":180158770,"user":{"login":"boazsegev","id":870622,"avatar_url":"https://avatars.githubusercontent.com/u/870622?v=3","gravatar_id":"","url":"https://api.github.com/users/boazsegev","html_url":"https://github.com/boazsegev","followers_url":"https://api.github.com/users/boazsegev/followers","following_url":"https://api.github.com/users/boazsegev/following{/other_user}","gists_url":"https://api.github.com/users/boazsegev/gists{/gist_id}","starred_url":"https://api.github.com/users/boazsegev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boazsegev/subscriptions","organizations_url":"https://api.github.com/users/boazsegev/orgs","repos_url":"https://api.github.com/users/boazsegev/repos","events_url":"https://api.github.com/users/boazsegev/events{/privacy}","received_events_url":"https://api.github.com/users/boazsegev/received_events","type":"User","site_admin":false},"created_at":"2016-02-05T02:13:16Z","updated_at":"2016-02-05T02:13:16Z","body":"The backtrace shows that the ERB renderer (which is part of the Ruby standard library) is the one failing.\r\n\r\nCan you try updating the template to write the encoding of the DB string instead of the string itself (change the `data` to `data.encoding.to_s`)? - this will help make sure that the database returns a UTF-8 encoded string.\r\n\r\nAlso, could you post the code you use for rendering (in the controller) and the code you use in the template?"}}