<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/17532" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2010-01-24T11:24:47-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/17532</id>

		<entry>
		<author><name><![CDATA[Reynaldo]]></name></author>
		<updated>2010-01-24T11:24:47-04:00</updated>

		<published>2010-01-24T11:24:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91811#p91811</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91811#p91811"/>
		<title type="html"><![CDATA[Please help with this character ( ¤)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91811#p91811"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>if {[regexp {\xa4} [encoding convertfrom utf-8 $rname]] == 1 || [string length $rname] &gt; 45} {..}</code></pre></div>Finally it's working perfect!!<br><br>Thank  you very much Guys. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_lol.gif" width="15" height="15" alt=":lol:" title="Laughing">  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6218">Reynaldo</a> — Sun Jan 24, 2010 11:24 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2010-01-24T10:37:38-04:00</updated>

		<published>2010-01-24T10:37:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91807#p91807</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91807#p91807"/>
		<title type="html"><![CDATA[Please help with this character ( ¤)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91807#p91807"><![CDATA[
You were already told how to make it work my man. Use "convertfrom utf-8" instead of "convertto utf-8" and it works without artifcating in those Â remnants into the string.<br><div class="codebox"><p>Code: </p><pre><code>&lt;speechles&gt; .tcl set rname [encoding convertfrom utf-8 "bla bla bla bla bla ¤"]&lt;bot&gt; Tcl: bla bla bla bla bla ¤&lt;speechles&gt; .tcl set result [regexp -- {\xa4} $rname]&lt;bot&gt; Tcl: 1&lt;speechles&gt; .tcl set rname [encoding convertfrom utf-8 "bla bla bla bla bla bla bla bla bla bla bla ¤ bla bla bla bla bla bla bla bla"]&lt;bot&gt; Tcl: bla bla bla bla bla bla bla bla bla bla bla ¤ bla bla bla bla bla bla bla bla&lt;speechles&gt; .tcl if {[regexp {\xa4} [encoding convertfrom utf-8 $rname]] == 1 || [string length $rname] &gt; 45} { set d "works" } { set d "fails" }&lt;bot&gt; Tcl: works</code></pre></div><div class="codebox"><p>Code: </p><pre><code>if {[regexp {\xa4} [encoding convertfrom utf-8 $rname]] == 1 || [string length $rname] &gt; 45} {..}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sun Jan 24, 2010 10:37 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Reynaldo]]></name></author>
		<updated>2010-01-23T23:06:12-04:00</updated>

		<published>2010-01-23T23:06:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91805#p91805</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91805#p91805"/>
		<title type="html"><![CDATA[Please help with this character ( ¤)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91805#p91805"><![CDATA[
set rname "bla bla bla bla bla ¤"<div class="codebox"><p>Code: </p><pre><code>if {[regexp {\xA4} $rname] == 1 || [string length $rname] &gt; 45} {..}</code></pre></div>Doesnt works! using eggdrop v1.6.18. <br>i'm going be silly with this char  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"><br>how about using scan method? just scan the last chars of $name, cause the ugly spammers always(not) have that silly char at the end of their realname<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6218">Reynaldo</a> — Sat Jan 23, 2010 11:06 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2010-01-23T14:44:29-04:00</updated>

		<published>2010-01-23T14:44:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91800#p91800</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91800#p91800"/>
		<title type="html"><![CDATA[Please help with this character ( ¤)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91800#p91800"><![CDATA[
Thanks guys. Thought I was going nuts there for a while.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Sat Jan 23, 2010 2:44 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2010-01-23T14:17:42-04:00</updated>

		<published>2010-01-23T14:17:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91799#p91799</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91799#p91799"/>
		<title type="html"><![CDATA[Please help with this character ( ¤)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91799#p91799"><![CDATA[
<blockquote class="uncited"><div>This smells like a character set issue...</div></blockquote>Indeed, this is one of those iso8859-1/utf-8 rendering issues. The easiest way to solve it, is to force the string your comparing against into utf-8. Then always use "\xa4" to do _any_ matching. -- OR-- Simply utf-8 patch your bot with thommey's utf-8 patch...<br><div class="codebox"><p>Code: </p><pre><code>** via partyline -- those Â's in the bot's response aren't rendered on IRC, just here on the forum. They make all the difference when matching though.&lt;speechles&gt; .tcl set text [encoding convertto utf-8 "Mp3 ¤ My Song - Yeah, it is.mp3 ¤"]&lt;bot&gt; Tcl: Mp3 Â¤ My Song - Yeah, it is.mp3 Â¤** A direct match of course fails ....&lt;speechles&gt; .tcl set b [regexp {¤} $text] &lt;bot&gt; Tcl: 0** Using \xa4 always works no matter where...&lt;speechles&gt; .tcl set b [regexp {\xa4} $text] &lt;bot&gt; Tcl: 1&lt;speechles&gt; .tcl if {[string match *\xa4* $text]} { set b "works" } { set b "fails" }&lt;bot&gt; Tcl: works&lt;speechles&gt; .tcl regexp -- {\xa4(.*?)\xa4} $text -&gt; result&lt;bot&gt; Tcl: 1** notice the remnant of that silly Â in the output. This is the utf-8 sequence broken by an unpatched bot.  The bottom way fixes this.&lt;speechles&gt; .tcl set showme $result&lt;bot&gt; Tcl: My Song - Yeah, it is.mp3 Â** the trick is use an atom (.) prior to the \xa4 in regexp's&lt;speechles&gt; .tcl regexp -- {.\xa4(.*?).\xa4} $text -&gt; result&lt;bot&gt; Tcl: 1&lt;speechles&gt; .tcl set showme $result&lt;bot&gt; Tcl: My Song - Yeah, it is.mp3** perfect!</code></pre></div>This is clearly an iso8859-1/utf-8 rendering/matching issue. I've dealt with these before... <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sat Jan 23, 2010 2:17 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2010-01-23T13:13:46-04:00</updated>

		<published>2010-01-23T13:13:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91798#p91798</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91798#p91798"/>
		<title type="html"><![CDATA[Please help with this character ( ¤)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91798#p91798"><![CDATA[
This smells like a character set issue...<br>All four "non-working" tests evaluate to true under a simple tclsh environment for me. When pasting the same code into a telnet session (still using the very same putty setup), all ¤ are converted to $, causing the patterns with \xA4 to fail, but the others to work...<br><br>Doing something as simple as "scan [format %c 164] %c" returns 164, as expected. If I enter the ¤ into the strings and patterns using [format ...], all patterns work without a problem, including the \xA4 ones...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Jan 23, 2010 1:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2010-01-23T12:37:31-04:00</updated>

		<published>2010-01-23T12:37:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91797#p91797</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91797#p91797"/>
		<title type="html"><![CDATA[Please help with this character ( ¤)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91797#p91797"><![CDATA[
Sorry about my earlier post. I should have tested first. I have no clue why it does not work. Other than possible solutions provided by TCL_no_TK methodology, the only way I can get the thing to work is by using a regexp with the actual character in question inside grouping elements ([ and ]), as follows :-<br><br>[16:27] &lt;@arfer&gt; % return [regexp -- {[¤]} "bla bla bla bla bla ¤"]<br>[16:27] &lt;@Baal&gt; 1<br><br>What really puzzles me is why none of the following will work :-<br><br>[16:29] &lt;@arfer&gt; % return [regexp -- {¤} "bla bla bla bla bla ¤"]<br>[16:29] &lt;@Baal&gt; 0<br><br>[16:29] &lt;@arfer&gt; % return [regexp -- {.*¤.*} "bla bla bla bla bla ¤"]<br>[16:29] &lt;@Baal&gt; 0<br><br>[16:35] &lt;@arfer&gt; % return [regexp -- {\xA4} "bla bla bla bla bla ¤"]<br>[16:35] &lt;@Baal&gt; 0<br><br>[16:36] &lt;@arfer&gt; % return [regexp -- {[\xA4]} "bla bla bla bla bla ¤"]<br>[16:36] &lt;@Baal&gt; 0<br><br>Anyway, the answer to your original query would be :-<br><div class="codebox"><p>Code: </p><pre><code>if {([regexp -- {[¤]} $rname]) || ([string length $rname] &gt; 45)} { .... }</code></pre></div>I think!<br><br>I wouldn't mind some sort of explanation for this myself. Where is our friend nml375 when we need him?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Sat Jan 23, 2010 12:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Reynaldo]]></name></author>
		<updated>2010-01-22T23:12:45-04:00</updated>

		<published>2010-01-22T23:12:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91792#p91792</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91792#p91792"/>
		<title type="html"><![CDATA[Please help with this character ( ¤)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91792#p91792"><![CDATA[
<blockquote class="uncited"><div><img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_rolleyes.gif" width="15" height="15" alt=":roll:" title="Rolling Eyes"> <div class="codebox"><p>Code: </p><pre><code> set text "¤ Mp3 ¤ My Song - Yeah, it is.mp3 ¤" set string [lindex [split $text] 0] set test [scan $string %c] if {$test == 164} {  putlog "detected that $text! starts with ¤ :P" }</code></pre></div> There's probably a much easyer and better way to do this</div></blockquote>Ok, that can detect if the char is in the first of the chars<br><br><br>set text "Mp3 ¤ My Song - Yeah, it is.mp3 ¤"<br><br>return of %c will be 77 of M<br><br>set hong [scan [string trimleft [lrange $rname 1 end]] %c]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6218">Reynaldo</a> — Fri Jan 22, 2010 11:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[TCL_no_TK]]></name></author>
		<updated>2010-01-22T22:13:45-04:00</updated>

		<published>2010-01-22T22:13:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91791#p91791</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91791#p91791"/>
		<title type="html"><![CDATA[Please help with this character ( ¤)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91791#p91791"><![CDATA[
<img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_rolleyes.gif" width="15" height="15" alt=":roll:" title="Rolling Eyes"> <div class="codebox"><p>Code: </p><pre><code> set text "¤ Mp3 ¤ My Song - Yeah, it is.mp3 ¤" set string [lindex [split $text] 0] set test [scan $string %c] if {$test == 164} {  putlog "detected that $text! starts with ¤ :P" }</code></pre></div> There's probably a much easyer and better way to do this<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8130">TCL_no_TK</a> — Fri Jan 22, 2010 10:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Reynaldo]]></name></author>
		<updated>2010-01-22T20:43:42-04:00</updated>

		<published>2010-01-22T20:43:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91790#p91790</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91790#p91790"/>
		<title type="html"><![CDATA[Please help with this character ( ¤)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91790#p91790"><![CDATA[
<blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code> set rname [format {%c} 164] set test [scan $rname %c]  if {$test == 164} {   puts "It Worked!"  }</code></pre></div> <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"></div></blockquote><div class="codebox"><p>Code: </p><pre><code>set rname [format {%c} 164] </code></pre></div>seems it's not working. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad">, the character is in $rname.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6218">Reynaldo</a> — Fri Jan 22, 2010 8:43 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[TCL_no_TK]]></name></author>
		<updated>2010-01-22T07:21:07-04:00</updated>

		<published>2010-01-22T07:21:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91783#p91783</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91783#p91783"/>
		<title type="html"><![CDATA[Please help with this character ( ¤)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91783#p91783"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code> set rname [format {%c} 164] set test [scan $rname %c]  if {$test == 164} {   puts "It Worked!"  }</code></pre></div> <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8130">TCL_no_TK</a> — Fri Jan 22, 2010 7:21 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Reynaldo]]></name></author>
		<updated>2010-01-22T02:17:20-04:00</updated>

		<published>2010-01-22T02:17:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91780#p91780</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91780#p91780"/>
		<title type="html"><![CDATA[Please help with this character ( ¤)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91780#p91780"><![CDATA[
<blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code>format {%c} "164"</code></pre></div></div></blockquote>how to use it?<br><div class="codebox"><p>Code: </p><pre><code>if {[string match "*[format {%c} "164"]*" $rname] || [string length $rname] &gt; 45} { .... } </code></pre></div>it's right? thanks for the advice.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6218">Reynaldo</a> — Fri Jan 22, 2010 2:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Reynaldo]]></name></author>
		<updated>2010-01-20T23:54:40-04:00</updated>

		<published>2010-01-20T23:54:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91767#p91767</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91767#p91767"/>
		<title type="html"><![CDATA[Please help with this character ( ¤)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91767#p91767"><![CDATA[
<blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code>if {[string match "*\xA4*" $rname] || [string length $rname] &gt; 45} { .... }</code></pre></div>The above should work fine because characters up to hex FF can be represented by using a backslash followed by an x and then the two digit hex number (164 decimal == A4 hex).<br><br>[12:51] &lt;arfer&gt; .tcl set varname \xA4<br>[12:51] &lt;Baal&gt; Tcl: ¤<br><br>BTW, you dont need to use == 1 with a string equal / string match. The fact that they return 1 (true) or 0 (false) can be used directly in a 'if' statement. Neither do you need the -nocase option since \xA4 is one specific character ie. it does not have an upper/lower case.</div></blockquote>still the bot cannot detect that character, i've try to use "*\00164*" also not working.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6218">Reynaldo</a> — Wed Jan 20, 2010 11:54 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2010-01-20T08:52:03-04:00</updated>

		<published>2010-01-20T08:52:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91761#p91761</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91761#p91761"/>
		<title type="html"><![CDATA[Please help with this character ( ¤)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91761#p91761"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>if {[string match "*\xA4*" $rname] || [string length $rname] &gt; 45} { .... }</code></pre></div>The above should work fine because characters up to hex FF can be represented by using a backslash followed by an x and then the two digit hex number (164 decimal == A4 hex).<br><br>[12:51] &lt;arfer&gt; .tcl set varname \xA4<br>[12:51] &lt;Baal&gt; Tcl: ¤<br><br>BTW, you dont need to use == 1 with a string equal / string match. The fact that they return 1 (true) or 0 (false) can be used directly in a 'if' statement. Neither do you need the -nocase option since \xA4 is one specific character ie. it does not have an upper/lower case.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Wed Jan 20, 2010 8:52 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[TCL_no_TK]]></name></author>
		<updated>2010-01-20T07:58:11-04:00</updated>

		<published>2010-01-20T07:58:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91760#p91760</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91760#p91760"/>
		<title type="html"><![CDATA[Please help with this character ( ¤)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91760#p91760"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>format {%c} "164"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8130">TCL_no_TK</a> — Wed Jan 20, 2010 7:58 am</p><hr />
]]></content>
	</entry>
	</feed>
