Thread: Encoding IRC

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    9
    Rep Power
    0

    Encoding IRC


    Encoding problem:
    My bot joins different irc channels than me (possible mismatch between "utf-8" or "iso-2022-jp").
    I try to join #よろしく channel, but I join #^[$B$h$m$7$/^[(B or #\xe3\x82\x88\xe3\x82\x8d\xe3\x81\x97\xe3\x81\x8f instead.

    Detected errors:
    UnicodeDecodeError: 'iso2022_jp' codec can't decode byte 0xe3 in position 1: illegal multibyte sequence

    "'ascii' codec can't decode byte 0xe3 in position 1: ordinal not in range(128)"
    How to fix it, plz?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    138
    Rep Power
    2
    Please post your code, otherwise it's very hard to help you. Also tell if you're using python2 or python3.
    http://www.catb.org/esr/faqs/smart-questions.html#code
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    9
    Rep Power
    0
    I'm working on Python 2.6
    Code:
    file01 = os.path.join(os.path.split(__file__)[0], 'chan01.txt')
    filo01=open(file01,  'r')
    linful01=filo01.readlines()
    channel=linful01[1].rstrip().decode('utf-8')
    Channel names are taken from chan01.txt file.
    Encoding in that file is 'Automatically Detected' according to the file settings.

IMN logo majestic logo threadwatch logo seochat tools logo