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.

Issues with special characters in scripts.

Help for those learning Tcl or writing their own scripts.
Post Reply
u
ujjain
Voice
Posts: 12
Joined: Mon Oct 11, 2010 10:12 am

Issues with special characters in scripts.

Post by ujjain »

I hope that I am able to explain this correctly, because nobody was able to help me on #eggdrop at Freenode.

Eggdrop scripts like Bogustrivia and GTranslate do not show special characters correctly, but show question-marks on many computers of my channel's users. I have no issues with mIRC, but I do not see the characters correctly with Pidgin.

Code: Select all

(16:18:28) ujjain: !tr de I am a loner.
(16:18:30) OmeletBot: (en) Ich bin ein Einzelg?nger.
I never had issues with foreign characters before with Pidgin when users used utf-8,only when they used a regional charset. Eggdrop is set to use utf-8. I checked this by adding a line that prints encoding in eggdrop.conf

The sourcecode of the script can be viewed at: http://www.codepad.eu/view/85674687.

When I have the bot talk in the channel via partyline, everything goes alright.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Re: Issues with special characters in scripts.

Post by speechles »

ujjain wrote:I hope that I am able to explain this correctly, because nobody was able to help me on #eggdrop at Freenode.

Eggdrop scripts like Bogustrivia and GTranslate do not show special characters correctly, but show question-marks on many computers of my channel's users. I have no issues with mIRC, but I do not see the characters correctly with Pidgin.

Code: Select all

(16:18:28) ujjain: !tr de I am a loner.
(16:18:30) OmeletBot: (en) Ich bin ein Einzelg?nger.
I never had issues with foreign characters before with Pidgin when users used utf-8,only when they used a regional charset. Eggdrop is set to use utf-8. I checked this by adding a line that prints encoding in eggdrop.conf

The sourcecode of the script can be viewed at: http://www.codepad.eu/view/85674687.

When I have the bot talk in the channel via partyline, everything goes alright.
That script doesn't appear to make use of utf-8, either through encodings or http config settings. It's making huge assumptions. So....
<speechles> !tr @de I am a loner.
<sp33chy> Google: (auto->de) English to German translation
<sp33chy> Ich bin ein Einzelgänger.
Here is an alternative way to check. Try using my script: here which includes google translations (among other things :D). While mine doesn't use the API, mine does things a little differently. Google is given special queries with mine that set the input/output encodings correctly to utf-8 while making queries. Mine also properly makes use of the -urlencoding feature of http package 2.5+ which should be set to utf-8, default is iso8859-1. I suspect this is where your issues are coming from. Try my script and see if these issues magically disappear. If so I can give you some quick hacks to correct that scripts short comings and make it work correctly.

NOTE: Also, that script limits itself for no reason to these languages below:
set lngs { "fr" "en" "es" "de" "it" "nl" }

Why it does this is beyond me. Google supports language's on the fly. So mine doesn't care what you put. If google supports it, you will either see a message saying "It's not supported yet" or the translated text. Your script appears to limit itself severly, so much so that Russians/Serbians/Hindis/Arabs/etc can't use it at all (racist perhaps?). Mine doesn't have any limitations, as google supports more languages my script natively works with them, always.
Post Reply