egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

UTF-8 input being garbled [solved]

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Eggdrop Help
View previous topic :: View next topic  
Author Message
artaslove
Voice


Joined: 14 Jun 2016
Posts: 4

PostPosted: Tue Jun 14, 2016 3:58 pm    Post subject: UTF-8 input being garbled [solved] Reply with quote

Hello,

I'm running eggdrop 1.8, patched to include UTF-8 support. My system LANG is set to UTF-8. My chat client supports UTF-8. The server I'm connecting to supports UTF-8. I have no troubles at all sending any sort of valid UTF-8 character to the channel my bot is connected to.

I have a simple script that connects to Microsoft translate and returns the translated result. It is working for many languages already. However when translating from Russian, Japanese, Chinese and possibly others it encounters a problem.

in my proc I experimented with "putlog $text" immediately at the beginning of the proc, where $text is everything the bot thinks the user has entered for that binding.

For example:

User enters: "!trans ru|en очень хорошо"
logfile shows: "ru|en >G5=L E>@>H>"

Naturally this does not work out to be the correct translation.

If I urlencode очень хорошо to %D0%BE%D1%87%D0%B5%D0%BD%D1%8C%20%D1%85%D0%BE%D1%80%D0%BE%D1%88%D0%BE and send it to the translator I get the expected result of "very well".

For some reason some UTF-8 characters work for example:
User enters: "!trans fr|en très bien"
logfile shows: "fr|en tr▒s bien"

However the character is correctly percent-encoded to %C8%A8 in that case and I get the expected result of "very well".

Thanks for any insight.


Last edited by artaslove on Tue Jun 14, 2016 9:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
artaslove
Voice


Joined: 14 Jun 2016
Posts: 4

PostPosted: Tue Jun 14, 2016 9:31 pm    Post subject: Reply with quote

Solved by http://forum.egghelp.org/viewtopic.php?t=18879

I was trying to use the solution at http://eggwiki.org/Bugs/Utf-8 which did not work in my case.
Back to top
View user's profile Send private message
artaslove
Voice


Joined: 14 Jun 2016
Posts: 4

PostPosted: Tue Jun 14, 2016 10:26 pm    Post subject: Reply with quote

Upon further investigation, while the script posted above did solve the issue with utf-8 input being garbled, it introduced some other problems with utf-8 output that I am still working out.
Back to top
View user's profile Send private message
artaslove
Voice


Joined: 14 Jun 2016
Posts: 4

PostPosted: Wed Jun 15, 2016 1:48 pm    Post subject: Reply with quote

I ended up getting the latest eggdrop 1.8 from github, which doesn't require the script above.

Everything is working well now.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Eggdrop Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber