This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Weird üöä ÖÄÜ bug ?

Old posts that have not been replied to for several years.
c
crichton
Voice
Posts: 8
Joined: Sat Jun 11, 2005 1:44 pm

Weird üöä ÖÄÜ bug ?

Post by crichton »

Hello, this is my first post here.
I use a eggdrop bot, hosted by a friend. After an Update to the newest eggdroop and TCL Version i have this weird bug.

The problem is that he cant sent ö ä ü (and other chars like ° and more) to channel, its alway scrambled to öäü. It happens only when theres a script executed message or something. If i do a .say on the partyline everythings allright, but if i execute an trigger (eg. !info) the problem occurs. What could it possibly be? the guy who installed it told me that it could only be a tcl problem, because it happened first after upgrading to newest tcl version. Is there an option to change language in the tcl prog?Or do you have any other suggestion?

Sorry for my bad english, im german and thats why i need the bot to use öäü chars.
none
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

the characters are UTF-8 encoded which mIRC can't display. Change your script to use umlaute encoded with ISO-8859-x or Windows-12xx. I personally never had problems with umlaute in eggdrop so far, because it doesnt matter if the bot sees them as "umlaute", all what matter is that it forwards them as they are :D.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

try putting encoding system iso8859-1 in your config
c
crichton
Voice
Posts: 8
Joined: Sat Jun 11, 2005 1:44 pm

Post by crichton »

Sorry for my dumb question, but how do i change the encoding?
Where do i have to put encoding system iso8859-1 ?

In my eggdrop.conf it had no effect!
Thanks!
none
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

on the party line, type .tcl encoding system

what does it say?
c
crichton
Voice
Posts: 8
Joined: Sat Jun 11, 2005 1:44 pm

Post by crichton »

it says iso8859-1
but when i execute my quotescript (wich had worked before) it shows me:
Quote 9/9 öäüöäüö

btw. thw .tcl doesnt work, i used !tcl from my channel, i use tcldebug.tcl

-.- should show me öäü öäü
none
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

are you sure this quote isnt from someone who used UTF-8 encoding while writing these chars?

PS: its "öäüöäüö", not "öäü öäü" :P (UTF-8 support from ultra edit rulez)
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
c
crichton
Voice
Posts: 8
Joined: Sat Jun 11, 2005 1:44 pm

Post by crichton »

I added this quote by hand in the quotefile, and the errors happen on every script that uses öäü ^^.

In the quotefile it is written the right way.

Im quite confused about that problem, because im relative new to eggdrops and dont realy know enough about that.

crichton
none
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

make sure when adding to quote file, you use an editor which saves the file in ISO 8859-1 encoding - then eggdrop should handle german umlauts correctly
c
crichton
Voice
Posts: 8
Joined: Sat Jun 11, 2005 1:44 pm

Post by crichton »

hmm
i used ultraedit to store but i have the problems even on those quotes added by the bot itself, i used addquote just a minute before and the quote i added was also in wrong format.

it has worked before the update!

i also have this on other scripts, i only used the quote script to check it easyly. im out of knowledge -.-

crichton
none
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

does the script use fconfigure or similar to change the encoding of the file?
<StarZ|Clan> [20:18:01] tcl: evaluate (.tcl): open test.txt w
<StarZ|Clan> Tcl: file17
<StarZ|Clan> [20:18:20] tcl: evaluate (.tcl): puts file17 "Hallö"
<StarZ|Clan> Tcl:
<StarZ|Clan> [20:18:30] tcl: evaluate (.tcl): close file17
<StarZ|Clan> Tcl:
<StarZ|Clan> [20:18:38] tcl: evaluate (.tcl): open test.txt r
<StarZ|Clan> Tcl: file17
<StarZ|Clan> [20:18:46] tcl: evaluate (.tcl): read file17
<StarZ|Clan> Tcl: Hallö
<StarZ|Clan> [20:18:59] tcl: evaluate (.tcl): close file17
<StarZ|Clan> Tcl:
just to show you, that there is no problem at general to write umlaute and read them again. this from a dcc session from mIRC with 100% NO UTF-8 support console :D.

you can repeat this test to see if you have general utf-8 enforcing on your shell.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
c
crichton
Voice
Posts: 8
Joined: Sat Jun 11, 2005 1:44 pm

Post by crichton »

Code: Select all

# x quotes will be posted in y seconds
set qot(flood) 3:10

# ignore flooders?
set qot(ignore) 1

# ignore time in minutes
set qot(ignore_time) 1

# Public command trigger
set qot(pubtrigger) {!}

# Quote Storage File
set qot(file) "scripts/dbase/quotes"

### DO NOT CHANGE THE FOLLOWING VALUES IF NOT NECESSARY (usually not)
### Changing these might cause the script to stop working

bind pub -|- ${qot(pubtrigger)}quote     qot_random
bind pub -|- ${qot(pubtrigger)}lastquote qot_last
bind pub o|- ${qot(pubtrigger)}addquote  qot_addquote
bind pub m|- ${qot(pubtrigger)}delquote  qot_del


proc srand {int} {
 if {[catch {expr $int} int]} {
   error "random limit must be greater than zero"
 } elseif {!$int} {
   error "random limit must be greater than zero"
 }
 return [expr [clock clicks] % $int]
}

proc qot_flood_init {} {
  global qot qot_flood_array
  if {![file isdirectory [file dirname $qot(file)]]} {
    file mkdir [file dirname $qot(file)]
  }
  if {![regexp {^([0-9]+):([0-9]+)$} $qot(flood) tmp qot(flood_num) qot(flood_time)]} {
    putcmdlog "Quote TCL: var qot(flood) not set correctly."
    return
  }
  set i [expr $qot(flood_num) - 1]
  while {$i >= 0} {
    set qot_flood_array($i) 0
    incr i -1
  }
}
qot_flood_init

proc qot_flood {nick uhost} {
  global qot qot_flood_array
  if {$qot(flood_num) == 0} {
    return 0
  }
  set i [expr $qot(flood_num) - 1]
  while {$i >= 1} {
    set qot_flood_array($i) $qot_flood_array([expr $i - 1])
    incr i -1
  }
  set qot_flood_array(0) [unixtime]
  if {[expr [unixtime] - $qot_flood_array([expr $qot(flood_num) - 1])] <= $qot(flood_time)} {
    if {$qot(ignore)} {
      newignore [maskhost [getchanhost $nick]] Quote-TCL "$nick flooded the quote script." $qot(ignore_time)
    }
    return 1
  } else {
    return 0
  }
}

proc qot_random {nick uhost hand chan text} {
 global qot
  if {![matchattr $hand o|o $chan]} {
    if {[qot_flood $nick $uhost]} {
      return 0
    }
  }
  if {![file exists $qot(file)]} {
    putquick "PRIVMSG $chan :Error: No quotes found, file doesn't exist."
    return 0
  }
  set file [open $qot(file) r+]
  for {set count 1} {![eof $file]} {incr count} {
    gets $file quotes($count)
  }
  close $file
  set count [array size quotes]
  unset quotes($count)
  incr count -1
  if {[string length [string trim $text *?]] == 0} {
    set value [srand $count+1]
    set current [expr {($value == 0) ? 1 : $value}]
    set quote $quotes($current)
    putquick "PRIVMSG $chan :Quote \002$current/$count\002 $quote"
    return 1
  } elseif {[regexp {^\d+$} $text]} {
    if {![info exists quotes($text)]} {
      putquick "PRIVMSG $chan :Error: That quote doesn't exist."
      return 1
    } else {
      set quote $quotes($text)
      putquick "PRIVMSG $chan :Quote \002$text/$count\002 $quote"
      return 1
    }
  } else {
    set text [string trim $text *]
    array set nquotes ""
    for {set current 1} {$current <= $count} {incr current} {
      if {[string match -nocase *[qot_clean $text]* $quotes($current)]} {
        regsub -all -nocase -- "([qot_rclean $text])" $quotes($current) "\002\\1\002" quotes($current)
        set nquotes($current) $quotes($current)
      }
    }
    if {[array size nquotes] == 0} {
      putquick "PRIVMSG $chan :No quotes matching '$text' found."
    } else {
      set value [lindex [array names nquotes] [srand [array size nquotes]]]
      set quote $nquotes($value)
      putquick "PRIVMSG $chan :Quote \002$value/$count\002 $quote"
    }
  }
}

proc qot_addquote {nick uhost hand chan text} {
 global qot;
  set file [open $qot(file) a+];
  puts $file [stripcodes uacgbr $text];
  close $file;
  putquick "NOTICE $nick :Added quote to storage facility.";
}

proc qot_del {nick uhost hand chan text} {
 global qot
  set delnum $text
  set type [lindex $text 0]
  set text [lrange $text 1 end]
  if {![file exists $qot(file)]} {
    putquick "PRIVMSG $chan :Error: No quotes found, file doesn't exist."
    return
  } else {
    set qot_fd [open $qot(file) r]
  }
  for {set qot_cnt 0} {![eof $qot_fd]} {incr qot_cnt 1} {
    gets $qot_fd qot_list($qot_cnt)
  }
  close $qot_fd
  set qot_cnt [expr $qot_cnt - 2]
  if {[string is integer $delnum]} {
    set qot_fd [open $qot(file) w]
    for {set i 0} {$i <= $qot_cnt} {incr i 1} {
      if {($qot_list($i) == "") || ($i == [expr $delnum - 1])} {
        putquick "PRIVMSG $chan :Quote [expr $i + 1] deleted"
        continue
      } else {
        puts $qot_fd $qot_list($i)
      }
    }
    close $qot_fd
  } elseif {$type == "num"} {
    set qot_fd [open $qot(file) w]
    for {set i 0} {$i <= $qot_cnt} {incr i 1} {
      if {($qot_list($i) == "") || ($i == [expr $text - 1])} {
       putquick "NOTICE $nick :Quote [expr $i + 1] deleted"
        continue
      } else {
        puts $qot_fd $qot_list($i)
      }
    }
    close $qot_fd
  }
}

proc qot_last {nick uhost hand chan text} {
 global qot
  if {[qot_flood $nick $uhost]} {
    return 0
  }
  if {![file exists $qot(file)]} {
    putquick "PRIVMSG $chan :Error: No quotes found, file doesn't exist."
    return
  } else {
    set qot_fd [open $qot(file) r]
  }
  for {set qot_cnt 0} {![eof $qot_fd]} {incr qot_cnt} {
    gets $qot_fd qot_list($qot_cnt)
  }
  close $qot_fd
  set qot_cnt [expr $qot_cnt - 2]
  set qot(last) $qot_list([expr $qot_cnt])
  putquick "PRIVMSG $chan :Quote \002[expr $qot_cnt + 1]/[expr $qot_cnt + 1]\002 $qot(last)"
  return
}

proc qot_rclean {i} {
  regsub -all -- {([\(\)\[\]\{\}\!\|\.\$\^\"\\])} $i {\\\1} i
  regsub -all -- {(\?)} $i "." i
  regsub -all -- {(\*)} $i ".*?" i
  return $i
}

proc qot_clean {i} {
  regsub -all -- {([\(\)\[\]\{\}\$\"\\])} $i {\\\1} i
  return $i
}

putlog "Loaded quote.tcl by perpleXa"
This is the quote script, but as i said it happens even when i do a simple trigger.

bind pub - !bier pub:bier
proc pub:bier { nick host hand chan text } {
global botnick
putact $chan "rennt schnell in die Küche um $nick sein eiskaltes Bier aus dem Kühlschrank zu holen!"
putmsg $chan "Bitte sehr $nick, hier ist dein eiskaltes Bier!"
}

This i have in a tcl file, and only this. When i run !bier it gives me:

! @|pilot| rennt schnell in die Küche um |crichton| sein eiskaltes Bier aus dem Kühlschrank zu holen!
[ @|pilot| ]Bitte sehr |crichton|, hier ist dein eiskaltes Bier!

Even at that simple script it does the error!

crichton
none
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

doesnt look like the cause is the script, so it must be with your eggdrop/tcl version. ircd can be excluded, since it doesnt appear with ".say". What happens if you use something like '.tcl putserv "privmsg #chan :Hallö, Umlaute müssen schön und schräg sein."' in the partyline?
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
c
crichton
Voice
Posts: 8
Joined: Sat Jun 11, 2005 1:44 pm

Post by crichton »

[ @|pilot| ] Hallö, Umlaute müssen schön und schräg sein.

this happens, everything is alright tho. but over any script there is no function for ö ä ü -.-

crichton
none
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

the problem is neither with your eggdrop/scripts, nor with your TCL

the problem is with your editor that you used to add quotes to quote file (or any other script source file) - or possibly with your keyboard driver and regional OS settings (that are active in editor's window; they might be different in another window, say in your mIRC window where you did your successful party line tests)

the bottom line is you need to save that quote file/scripts with correct ISO 8859-1 encoding (or fix your scripts to use whatever encoding they have been saved with)
Locked