<?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/20868" />

	<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>2020-10-19T16:30:43-04:00</updated>

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

		<entry>
		<author><name><![CDATA[doni]]></name></author>
		<updated>2020-10-19T16:30:43-04:00</updated>

		<published>2020-10-19T16:30:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=109090#p109090</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=109090#p109090"/>
		<title type="html"><![CDATA[accented letters]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=109090#p109090"><![CDATA[
Hi, I have this problem with accented letters: Ã² Ã¨ Ã¬  <br>should be è ò à ù <br><br>someone can help me?<br>thanks<br><br>this is the tcl script:<div class="codebox"><p>Code: </p><pre><code>########################################################################                                                                     ## rssnews.tcl - RSS news announcer for eggdrop by demond@demond.net   ##                                                                     ##               this will announce the updated news from RSS feed(s), ##               periodically polling the feed(s); supports multiple   ##               channels/multiple feeds per channel; you only need to ##               set up your feeds array, see below; secure (SSL) and  ##               private (password-protected) feeds are also supported ##                                                                     ##        Usage: !news &lt;feed name&gt; [news index #] - from channel       # #               .rss &lt;add|del|list&gt; [name:#chan] - from partyline     ##                                                                     ########################################################################package require Tcl 8.3package require eggdrop 1.6package require http 2.0package require tls http::register https 443 [list ::tls::socket -require 0 -request 1] namespace eval rssnews {set feeds(ACMilan:#milan) {3 https://www.milannews.it/rss/?section=32}# set your feed(s) sources here: feed name, channel, poll frequency in mins, feed URL##set feeds(osnews:#chan1) {17 http://www.osnews.com/files/recent.rdf}#set feeds(google:#chan2) {11 http://news.google.com/news?ned=us&amp;topic=h&amp;output=rss}## if you have to use password-protected feed, set it up like this:##set feeds(name3:#chan3) {13 http://some.site.com/feed username password}# maximum number of announced new headlines#variable maxnew 5# feed fetch timeout in seconds#variable timeout 20# public trigger flood settings#variable pubflud 5:15# support SSL feeds (requires TLS package)#variable usessl 0# if usessl is 1, request/require valid certificate from server#variable reqcert yes:no######################################################################## nothing to edit belowvariable version "rssnews-2.2"if {$usessl} {package require tls 1.5scan $reqcert {%[^:]:%s} r1 r2if {$r1 == "yes"} {set r1 1} {set r1 0}if {$r2 == "yes"} {set r2 1} {set r2 0}set ssl [list ::tls::socket -request $r1 -require $r2]::http::register https 443 $ssl}bind dcc  m rss   [namespace current]::rssbind pub  - !news [namespace current]::newsbind time - *     [namespace current]::timerputlog "$version by demond loaded"proc timer {min hour day month year} {variable feedsif {[info exists feeds]} {set mins [expr [scan $min %d]+[scan $hour %d]*60]foreach {chanfeed settings} [array get feeds] {if {$mins % [lindex $settings 0] == 0} {if {[llength $settings] &gt; 2} {foreach {t url user pass} $settings {break} fetch $url $chanfeed $user $pass} {foreach {t url} $settings {break}fetch $url $chanfeed}}}}}proc fetch {url chanfeed args} {variable timeoutvariable version; variable tokenset to [expr {$timeout * 1000}]set cmd [namespace current]::callbackif {[llength $args] &gt; 0} {foreach {user pass} $args {break}set hdr [list Authorization "Basic [b64en $user:$pass]"]} {set hdr {}}::http::config -useragent "$version by demond"if {[catch {set t [::http::geturl $url -command $cmd -timeout $to -headers $hdr]} err]} {putlog "$version: ERROR($chanfeed): $err"} {set token($t) [list $url $chanfeed $args]}}proc callback {t} {variable version; variable tokenforeach {url chanfeed args} $token($t) {break}switch -exact [::http::status $t] {"timeout" {putlog "$version: ERROR($chanfeed): timeout"}"error" {putlog "$version: ERROR($chanfeed): [::http::error $t]"}"ok" {switch -glob [::http::ncode $t] {3* {upvar #0 $t statearray set meta $state(meta)fetch $meta(Location) $chanfeed $args}200 {process [::http::data $t] $chanfeed}default {putlog "$version: ERROR($chanfeed): [::http::code $t]"}}}default {putlog "$version: ERROR($chanfeed): got EOF from socket"}}::http::cleanup $t}proc process {data chanfeed} {variable news; variable hashvariable maxnew; variable sourceset idx 1; set count 0scan $chanfeed {%[^:]:%s} feed chanset news($chanfeed) {}; set source($chanfeed) ""if {[regexp {(?i)&lt;title&gt;(.*?)&lt;/title&gt;} $data -&gt; foo]} {append source($chanfeed) $foo}if {[regexp {(?i)&lt;description&gt;(.*?)&lt;/description&gt;} $data -&gt; foo]} {append source($chanfeed) " | $foo"}set infoline $source($chanfeed)regsub -all {(?i)&lt;items.*?&gt;.*?&lt;/items&gt;} $data {} dataforeach {foo item} [regexp -all -inline {(?i)&lt;item.*?&gt;(.*?)&lt;/item&gt;} $data] {regexp {(?i)&lt;title.*?&gt;(.*?)&lt;/title&gt;}  $item -&gt; titleregexp {(?i)&lt;link.*?&gt;(.*?)&lt;/link}     $item -&gt; linkregexp {(?i)&lt;desc.*?&gt;(.*?)&lt;/desc.*?&gt;} $item -&gt; descrif {![info exists title]} {set title "(none)"}if {![info exists link]}  {set link  "(none)"}if {![info exists descr]} {set descr "(none)"}strip title link descrif {[info exists hash($chanfeed)]} {if {[lsearch -exact $hash($chanfeed) [md5 $title]] == -1 &amp;&amp; [botonchan $chan]} {if {![info exists header]} {if {$infoline == ""} {set header $feed} {set header $infoline} #puthelp "privmsg $chan :-\002 Ultimissima \002sul Milan -"}if {$count &lt; $maxnew} {puthelp "privmsg $chan :MILAN NEWS » $title"incr count} {lappend indices $idx}}}lappend news($chanfeed) [list $title $link $descr]lappend hashes [md5 $title]incr idx}if {[info exists indices] &amp;&amp; [botonchan $chan]} {set count [llength $indices]set indices "(indices: [join $indices {, }])"puthelp "privmsg $chan :...and $count more $indices" }set hash($chanfeed) $hashes}proc strip {args} {variable htmlforeach a $args {upvar $a xset amp {&amp; &amp;}set x [string map $amp $x]set x [string map $html $x]while {[regexp -indices {(&amp;#[0-9]{1,3};)} $x -&gt; idxs]} {set b [lindex $idxs 0]; set e [lindex $idxs 1]set num [string range $x [expr {$b+2}] [expr {$e-1}]]if {$num &lt; 256} {set x [string replace $x $b $e [format %c $num]]}}regexp {(?i)&lt;!\[CDATA\[(.*?)\]\]&gt;}   $x -&gt;    xregsub -all {(?i)&lt;/t[dr]&gt;&lt;t[dr].*?&gt;} $x { | } xregsub -all {(?i)(&lt;p&gt;|&lt;br&gt;|\n)}      $x { }   xregsub -all {&lt;[^&lt;]+?&gt;}               $x {}    x}}proc rss {hand idx text} {variable feedsif {$text == ""} {putdcc $idx "Usage: .$::lastbind &lt;add|del|list&gt; \[name:#chan \[feed\]\]"return}set text [split $text]switch [lindex $text 0] {"list" {if {[info exists feeds]} {foreach {chanfeed settings} [array get feeds] {putdcc $idx "$chanfeed -&gt; [join $settings]" }}}"add" {if {[llength $text] &lt; 4} {putdcc $idx "not enough add arguments"return}set chanfeed [lindex $text 1]if {[info exists feeds]} {set names [string tolower [array names feeds]]if {[lsearch -exact $names [string tolower $chanfeed]] != -1} {putdcc $idx "$chanfeed already exists"return}}set feeds($chanfeed) [lrange $text 2 end]}"del" {set chanfeed [lindex $text 1]if {[info exists feeds]} {set names [string tolower [array names feeds]]if {[lsearch -exact $names [string tolower $chanfeed]] == -1} {putdcc $idx "$chanfeed does not exist"return} {unset feeds($chanfeed) }}}default {putdcc $idx "invalid sub-command"return}}return 1 }proc news {nick uhost hand chan text} {variable sourcevariable news; variable feedsvariable pcount; variable pubfludif {[info exists pcount]} {set n [lindex $pcount 1]; incr nset ts [lindex $pcount 0]set pcount [list $ts $n]scan $pubflud {%[^:]:%s} maxr maxtif {$n &gt;= $maxr} {if {[unixtime] - $ts &lt;= $maxt} {return}set n 1; set ts [unixtime]}} {set n 1; set ts [unixtime]}set pcount [list $ts $n]set num [lindex [split $text] 1]set feed [lindex [split $text] 0]if {$text == ""} {foreach {key value} [array get feeds] {scan $key {%[^:]:%s} name channelif {[string eq -noc $chan $channel]} {lappend names $name}}if {[info exists names]} {set names [join $names {, }]puthelp "notice $nick :feed(s) for $chan: $names"puthelp "notice $nick :type $::lastbind &lt;feed&gt; \[index#\]"} {puthelp "notice $nick :no feed(s) for $chan"}return 1}if {![info exists news($feed:$chan)]} {puthelp "notice $nick :no news from $feed on $chan"return 1}if {$num == ""} {set idx 1if {$source($feed:$chan) != ""} {set title $source($feed:$chan)} {set title [lindex $feeds($feed:$chan) 1]}puthelp "notice $nick :- Le ultime news sul\002 Milan \002-"foreach item $news($feed:$chan) {puthelp "notice $nick :» [lindex $item 0]"incr idx}return 1} elseif {![string is integer $num]} {puthelp "notice $nick :news index must be number"return 1}if {$num &lt; 1 || $num &gt; [llength $news($feed:$chan)]} {puthelp "notice $nick :no such news index, try $::lastbind $feed"return 1} {set idx [expr {$num-1}]puthelp "notice $nick :......title($num): [lindex [lindex $news($feed:$chan) $idx] 0]"puthelp "notice $nick :description($num): [lindex [lindex $news($feed:$chan) $idx] 2]"puthelp "notice $nick :.......link($num): [lindex [lindex $news($feed:$chan) $idx] 1]"return 1}}# this proc courtesy of RS,# from http://wiki.tcl.tk/775 proc b64en str {binary scan $str B* bitsswitch [expr {[string length $bits]%6}] {0 {set tail ""}2 {append bits 0000; set tail ==}4 {append bits 00; set tail =}}return [string map {000000 A 000001 B 000010 C 000011 D 000100 E 000101 F000110 G 000111 H 001000 I 001001 J 001010 K 001011 L001100 M 001101 N 001110 O 001111 P 010000 Q 010001 R010010 S 010011 T 010100 U 010101 V 010110 W 010111 X011000 Y 011001 Z 011010 a 011011 b 011100 c 011101 d011110 e 011111 f 100000 g 100001 h 100010 i 100011 j100100 k 100101 l 100110 m 100111 n 101000 o 101001 p101010 q 101011 r 101100 s 101101 t 101110 u 101111 v110000 w 110001 x 110010 y 110011 z 110100 0 110101 1110110 2 110111 3 111000 4 111001 5 111010 6 111011 7111100 8 111101 9 111110 + 111111 /} $bits]$tail}variable html {"     \x22  &amp;apos;     \x27  &amp;      \x26  &lt;       \x3C&gt;       \x3E        \x20  ¡    \xA1  ¤   \xA4¢     \xA2  £    \xA3  ¥      \xA5  ¦   \xA6§     \xA7  ¨      \xA8  ©     \xA9  ª     \xAA«    \xAB  ¬      \xAC  ­      \xAD  ®      \xAE¯     \xAF  °      \xB0  ±   \xB1  ²     \xB2³     \xB3  ´    \xB4  µ    \xB5  ¶     \xB6·   \xB7  ¸    \xB8  ¹     \xB9  º     \xBA»    \xBB  ¼   \xBC  ½   \xBD  ¾   \xBE¿   \xBF  ×    \xD7  ÷   \xF7  À   \xC0Á   \xC1  Â    \xC2  Ã   \xC3  Ä     \xC4Å    \xC5  Æ    \xC6  Ç   \xC7  È   \xC8É   \xC9  Ê    \xCA  Ë     \xCB  Ì   \xCCÍ   \xCD  Î    \xCE  Ï     \xCF  Ð      \xD0Ñ   \xD1  Ò   \xD2  Ó   \xD3  Ô    \xD4Õ   \xD5  Ö     \xD6  Ø   \xD8  Ù   \xD9Ú   \xDA  Û    \xDB  Ü     \xDC  Ý   \xDDÞ    \xDE  ß    \xDF  à   \xe0  á   \xE1â    \xE2  ã   \xE3  ä     \xE4  å    \xE5æ    \xE6  ç   \xE7  è   \xe8  é   \xE9ê    \xEA  ë     \xEB  ì   \xec  í   \xEDî    \xEE  ï     \xEF  ð      \xF0  ñ   \xF1ò   \xf2  ó   \xF3  ô    \xF4  õ   \xF5ö     \xF6  ø   \xF8  ù   \xf9  ú   \xFAû    \xFB  ü     \xFC  ý   \xFD  þ    \xFEÿ     \xFF  }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12756">doni</a> — Mon Oct 19, 2020 4:30 pm</p><hr />
]]></content>
	</entry>
	</feed>
