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.

[Solved] color codes not interpreted but displayed

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
CrazyCat
Revered One
Posts: 1353
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

[Solved] color codes not interpreted but displayed

Post by CrazyCat »

Hello there,

I've a small tcl containing sentences with color code, as : "\0034Alert\003 : error in code"

These sentences are loaded in an array in my script, but when the line is used by my script, I get the color code in the channel.

Here is the way I load the sentences:

Code: Select all

proc file:load {} {
    set jp [open $::filename "r"]
    set jdata [read -nonewline $jp]
    close $jp
    set ::j_list ""
    foreach templine [split $jdata "\n"] {
        set line [split $templine "="]
        set jkey [string tolower [lindex $line 0]]
        lappend ::j_list $jkey
        set ::key_gen($jkey) [lindex $line 1]
        bind pubm - "*:$jkey*" file:display
    }
}
Any idea about this "bug" ?

[EDIT]
Making a small test, error appears when getting datas from a file. Seems to be an escape of \ ?
Last edited by CrazyCat on Tue Oct 01, 2013 3:24 am, edited 1 time in total.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Escape sequences are never substituted when reading a file. If you trust the contents of the file to be safe, you could use subst to do the substitutions...
NML_375
User avatar
CrazyCat
Revered One
Posts: 1353
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

MenzAgitat gaves me the solution on my forum: join the line. And it works fine.
Post Reply