lifo / cramp

Real-time web application framework in Ruby
http://cramp.in
MIT License
1.5k stars 121 forks source link

Incompatible character encodings #24

Closed ayamomiji closed 10 years ago

ayamomiji commented 13 years ago

When I rendering data with chinese or japanese to a Firefox websocket client, it causes these:

shared/bundle/ruby/1.9.1/gems/cramp-0.15.1/lib/cramp/websocket/protocol10_frame_parser.rb:199:in `send_frame': incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)
    from shared/bundle/ruby/1.9.1/gems/cramp-0.15.1/lib/cramp/websocket/protocol10_frame_parser.rb:203:in `send_text_frame'
    from shared/bundle/ruby/1.9.1/gems/cramp-0.15.1/lib/cramp/action.rb:77:in `render_websocket'
    from shared/bundle/ruby/1.9.1/gems/cramp-0.15.1/lib/cramp/action.rb:14:in `render'

I tried modify the line to frame.force_encoding('utf-8') and it works fine, but I'm not sure is that the best solution?