Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@s doesn't work if message-history contains non-ASCII #70

Closed
bazz1tv opened this issue May 13, 2016 · 2 comments
Closed

@s doesn't work if message-history contains non-ASCII #70

bazz1tv opened this issue May 13, 2016 · 2 comments
Labels

Comments

@bazz1tv
Copy link
Owner

bazz1tv commented May 13, 2016

[2016/05/12 22:11:41.256] !! /usr/share/gems/gems/json-1.8.3/lib/json/common.rb:155:in `encode': "\xC2" on US-ASCII (Encoding::InvalidByteSequenceError)
[2016/05/12 22:11:41.256] !!    /usr/share/gems/gems/json-1.8.3/lib/json/common.rb:155:in `initialize'
[2016/05/12 22:11:41.256] !!    /usr/share/gems/gems/json-1.8.3/lib/json/common.rb:155:in `new'
[2016/05/12 22:11:41.257] !!    /usr/share/gems/gems/json-1.8.3/lib/json/common.rb:155:in `parse'
[2016/05/12 22:11:41.257] !!    /home/bazz/Code/ayumi/lib/cinch/plugins/s.rb:44:in `block in execute'
[2016/05/12 22:11:41.257] !!    /home/bazz/Code/ayumi/lib/cinch/plugins/s.rb:44:in `map'
[2016/05/12 22:11:41.257] !!    /home/bazz/Code/ayumi/lib/cinch/plugins/s.rb:44:in `execute'
[2016/05/12 22:11:41.257] !!    /home/bazz/.gem/ruby/gems/cinch-2.3.1/lib/cinch/plugin.rb:418:in `call'
[2016/05/12 22:11:41.257] !!    /home/bazz/.gem/ruby/gems/cinch-2.3.1/lib/cinch/plugin.rb:418:in `block (2 levels) in __register_matchers'
[2016/05/12 22:11:41.257] !!    /home/bazz/.gem/ruby/gems/cinch-2.3.1/lib/cinch/handler.rb:99:in `call'
[2016/05/12 22:11:41.257] !!    /home/bazz/.gem/ruby/gems/cinch-2.3.1/lib/cinch/handler.rb:99:in `block in call'
[2016/05/12 22:11:41.257] !! [Thread done] For #<Cinch::Handler @event=:message pattern=#<Cinch::Pattern:0x00557f9d2961d0 @prefix="@", @pattern=/s\/(.+)\/(.*)\/([ig]+)?/, @suffix=nil>>: #<Thread:0x00557f9d182550> -- 0 remaining.
[2016/05/12 22:11:43.856] >> :[email protected]

that is this line:
history = @bot.redis.lrange(list, 0, 100).map { |msg| JSON.parse msg }

an example of a problematic msg is likely こんにちは

the JSON string comes in the form:
{"nick":"bazz","message":"derp"}

@bazz1tv bazz1tv added the bug label May 13, 2016
@bazz1tv
Copy link
Owner Author

bazz1tv commented May 13, 2016

this seems to be solved by stevekinney/pizza#103 Encoding.default_external = 'UTF-8'

@bazz1tv
Copy link
Owner Author

bazz1tv commented May 13, 2016

8b0e726

@bazz1tv bazz1tv closed this as completed May 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant