Code: Select all
# calculator
} elseif {[string match "*<img src=/images/calc_img*" $html] == 1} {
set calc 1
# remove bold codes from the html, not necessary here.
regexp -nocase -- {calc_img.*?<h2 class=.*?>(.+?)</h2>} $html - desc
regsub -all -- {<(.+?)>} $desc "" desc
if {$::incith::google::short_answers > 0 } { return "$::incith::google::desc_modes[descdecode $desc]" }
set link ""
Code: Select all
# calculator
} elseif {[string match "*<img src=/images/calc_img*" $html] || [string match "*<img src=\"/images/icons/onebox/calculator*" $html]} {
set calc 1
# remove bold codes from the html, not necessary here.
regexp -nocase -- {/calc.*?<h2 class=.*?>(.+?)</h2>} $html - desc
regsub -all -- {<(.+?)>} $desc "" desc
if {$::incith::google::short_answers > 0 } { return "$::incith::google::desc_modes[descdecode $desc]" }
set link ""
Code: Select all
# Google translation input/output encodings
# set these below to either:
# 0 for automatic encoding
# 1 for utf-8
# You may use switches to inverse this behavior on-the-fly. Set them
# below as well.
# ------
variable trans_input 1
variable trans_output 0
variable trans_input_t "--swapi"
variable trans_output_t "--swapo"
# enable encoding conversion, set this to 1 to enable.
# with this enabled it will follow the format of encoding conversions listed
# below. these will affect both input and output and will follow country switch.
# ------
variable encoding_conversion_input 1
variable encoding_conversion_output 1
# enable dirty decoding? This attempts to use the regular "dirty" method
# of rendering html elements which works well with iso8859-1 and other
# latin variants. This does not work well at all with russian, japanese,
# and any other non-latin variants. So keep this at 0 if you want a truly
# multi-language bot, but keep in mind you may see unrendered &x12345; html
# elements. This is because I don't know of a method to transcode these
# to proper utf-8 characters yet.. :P
# ------
# NOTE: If you bot is properly utf-8 patched, setting this to 1 is recommened.
# ------
variable dirty_decode 1
# enable gzip compression for bandwidth savings? Keep in mind
# this semi-breaks some of the present utf-8 work-arounds and
# eggdrop may mangle encodings when gzip compression that it
# doesn't when uncompressed html it used (default). A setting
# of 0 defaults to uncompressed html, a 1 or higher gzip.
# ------
# NOTE: If you do not have Trf or zlib packages setting this
# to 0 is recommened. Leaving it at 1 is fine as well, as the
# script will attempt to find these commands or packages every
# rehash or restart. But to keep gzip from ever being used it
# is best to set the below variable to 0.
# NOTE2: If you have Trf or zlib packages present, then this
# should always be set to 1. You save enormous bandwidth and
# time using this. If your bot is patched and you have Trf/zlib
# then you should definitely leave this at 1 and you will never
# suffer issues.
# ------
variable use_gzip 1
# THIS IS TO BE USED TO DEVELOP A BETTER LIST FOR USE BELOW.
# To work-around certain encodings, it is now necessary to allow
# the public a way to trouble shoot some parts of the script on
# their own. To use these features involves the two settings below.
# -- DEBUG INFORMATION GOES BELOW --
# set debug and administrator here
# this is used for debugging purposes
# ------
variable debug 0
variable debugnick spithash
# AUTOMAGIC
# with this set to 1, the bottom encode_strings setting will become
# irrelevant. This will make the script follow the charset encoding
# the site is telling the bot it is.
# This DOES NOT affect wiki(media/pedia), it will not encode automatic.
# Wiki(media/pedia) still requires using the encode_strings section below.
# ------
# NOTE: If your bot is utf-8 pathced, leave this option at 1, the only
# time to change this to 0 is if your having rendering problems.
# ------
variable automagic 1
# UTF-8 Work-Around (for eggdrop, this helps automagic)
# If you use automagic above, you may find that any utf-8 charsets are
# being mangled. To keep the ability to use automagic, yet when utf-8
# is the charset defined by automagic, this will make the script instead
# follow the settings for that country in the encode_strings section below.
# ------
# NOTE: If you bot is utf-8 patched, set this to 0. Everyone else, use 1.
# ------
variable utf8workaround 0
My experience with UTF-8 compiled bots is you need to comment outspithash wrote:after patching my bot with utf support, the script's bolding stopped working.
Thoughts?
*EDIT*
I used this: http://eggwiki.org/Utf-8 and it works great. after this though, bolding stopped working on google script.
And here are my settings:
Code: Select all
if {![string equal $incithcharset [encoding system]]} { set text [encoding convertto $incithcharset $text] }