Eggheads: accepting commands in UTF

Derek Kuliсski takeda at takeda.tk
Sat Mar 4 16:25:04 CST 2006


Hello CoolCold,

Friday, March 3, 2006, 10:46:15 AM, you wrote:


DK>> You didn't told us how the script looks like.
DK>> Anyway eggdrop currently don't have any UTF-8 support....
> Script is really simple:
> bind pub - !t                   ::trans::pub_trans

> proc ::trans::pub_trans {nick uhost hand chan args} {
>         if {[channel get $chan nopubtrans]} return
>         putlog "query is [lindex $args 0]"
>         if { [llength [split [lindex $args 0] ] ] > 1 || [llength
> [split [lindex $args 0] ] ] == 0 } { set args [split [
> lindex $args 0]] }
>         ::trans::trans $nick $uhost $hand $chan $args
> }

> Why eggdrop trancate input string into smth weird?
> Never tryed binds' params in utf, but if to work with sockets,
> everything fine, so i guess tcl is not what i need to debug :)

Did you set LANG variable to UTF-8 before starting eggdrop?
e.g.
env LANG=en_EN.UTF-8

Actually Tcl is localized and is observing the LANG variable.

I think the problem is most likely fault of eggdrop, because eggdrop
still is using the old functions that aren't localized.
For eggdrop any string that goes through is interpreted as ascii
string.
The problem with UTF is that is using multibyte encoding. So length of
the string cannot be calculated by counting the bytes of the string.

Most likely the problem is that tcl tells eggdrop that the string has
14 characters, but in UTF 14 characters doesn't mean 14 bytes. Since
eggdrop don't know UTF it cuts out 14 bytes.

As for the solution. The best thing would be to convert eggdrop to use
internationalized functions to process the text. This probably is a
really big task. There is probably easier solution by just fixing this
part of code where you have error, but I'm sure there are more places
that have similar issue.

Anyone interested in fixing this?

-- 
Best regards,
 Derek                            mailto:takeda at takeda.tk
CCNA, SCSA, SCNA, LPIC, MCP certified
http://www.takeda.tk

In headlines today, the dreaded killfile virus spread across the country adding 'aol.com' to people's Usenet kill files everywhere. The programmer of the virus still remains anonymous, but has been nominated several times for a Nobel peace prize.
-- Mark Atkinson 




More information about the Eggheads mailing list