| View previous topic :: View next topic |
| Author |
Message |
artaslove Voice
Joined: 14 Jun 2016 Posts: 4
|
Posted: Tue Jun 14, 2016 3:58 pm Post subject: UTF-8 input being garbled [solved] |
|
|
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 |
|
 |
artaslove Voice
Joined: 14 Jun 2016 Posts: 4
|
|
| Back to top |
|
 |
artaslove Voice
Joined: 14 Jun 2016 Posts: 4
|
Posted: Tue Jun 14, 2016 10:26 pm Post subject: |
|
|
| 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 |
|
 |
artaslove Voice
Joined: 14 Jun 2016 Posts: 4
|
Posted: Wed Jun 15, 2016 1:48 pm Post subject: |
|
|
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 |
|
 |
|