Code Monkey home page Code Monkey logo

Comments (3)

robbiemu avatar robbiemu commented on August 25, 2024

running your sample code from irb, I get the same error:

$ irb
001:0> require 'cinch'
true
002:0> Cinch::VERSION
"1.0.1"
003:0> class Bot
004:1>     def self.bot
005:2>         bot = Cinch::Bot.new do
006:3*               configure do |c|
007:4*                   c.server   = "irc.freenode.org"
008:4>                 c.nick     = "TestmeBot"
009:4>                 c.channels = ["#cinch"]
010:4>               end
011:3>       
012:3*               on :message, /^!msg (.+?) (.+)/ do |m, who, text|
013:4*                   User(who).send text
014:4>               end
015:3>           end
016:2>       end
017:1>   end
nil
018:0> Bot.bot.start
!! Connecting to irc.freenode.org:6667
<< NICK TestmeBot
!! /usr/lib/ruby/gems/1.9.3dev/gems/cinch-1.0.1/lib/cinch/irc.rb:46:in `gets': code converter not found (UTF-8 to UTF-8) (Encoding::ConverterNotFoundError)
!!  /usr/lib/ruby/gems/1.9.3dev/gems/cinch-1.0.1/lib/cinch/irc.rb:46:in `block in connect'
<< USER TestmeBot 0 * :cinch
fatal: deadlock detected
    from /usr/lib/ruby/1.9.3dev/thread.rb:189:in `sleep'
    from /usr/lib/ruby/1.9.3dev/thread.rb:189:in `block in pop'
    from :10:in `synchronize'
    from /usr/lib/ruby/1.9.3dev/thread.rb:184:in `pop'
    from /usr/lib/ruby/gems/1.9.3dev/gems/cinch-1.0.1/lib/cinch/message_queue.rb:52:in `process!'
    from /usr/lib/ruby/gems/1.9.3dev/gems/cinch-1.0.1/lib/cinch/irc.rb:60:in `connect'
    from /usr/lib/ruby/gems/1.9.3dev/gems/cinch-1.0.1/lib/cinch/bot.rb:404:in `start'
    from (irb):18
    from /usr/bin/irb:12:in `'

my encoding stuff should be correct. my shell LANG is es_EC.utf8 and ruby picks it up as utf-8 encoding. Here is the encoding stuff from my .irbrc

# encoding: utf-8
[...]
Encoding.default_internal="utf-8"
Encoding.default_external="utf-8"

from cinch.

dominikh avatar dominikh commented on August 25, 2024

Setting default_internal to the same value as default_external will lead to Ruby attempting to convert from utf-8 to utf-8, which is not possible.

I might include a check/fix for that, but I am unsure yet.

from cinch.

dominikh avatar dominikh commented on August 25, 2024

check if internal and external encoding are the same

If setting both internal_encoding and external_encoding to the same
encoding, Ruby will raise an exception because it can't convert
between the two. But apparantly, some users have such a setup, so we
explicitly check for that and don't set an internal encoding for the
socket if it'd equal the external encoding.

Closed by 06891c6

from cinch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.