0

Is it possible to get there unicode support? Right now on IdIRC1PrivateMessage i have '?' Thanks for help.

procedure TForm1.IdIRC1PrivateMessage(ASender : TIdContext;
const ANicknameFrom, AHost, ANicknameTo, AMessage : unicodestring);

begin
  Memo1.Lines.Add(TimeToStr(Time) + ': ' + ANicknameFrom + ':  ' + AMessage);
end;

Indy version: 10.5.8.0. When i will send message in mIRC eg 'żźć' i will get "???" in delphi

Arioch 'The
  • 15,799
  • 35
  • 62
user2512579
  • 55
  • 3
  • 9
  • IRC is an obsolete protocol, that does not know about languages, charsets, and unicode as well. http://en.wikipedia.org/wiki/IRC#Character_encoding Can you use XMPP or some other modern protocol instead ? – Arioch 'The Jun 22 '13 at 22:58
  • "Right now on IdIRC1PrivateMessage i have '?'" what do you mean ? Oh, and by the way, what do you mean by "unicode" ? there is a half-dozen of Unicode formats. Specifying Indy version would be a good thing too. Sometimes it becomes important info. And maybe getting new Indy version: http://www.indyproject.org/Sockets/Download/Files/Indy10.EN.aspx – Arioch 'The Jun 22 '13 at 22:59
  • Indy version: 10.5.8.0. When i will send message in mIRC eg 'żźć' i will get "???" in delphi – user2512579 Jun 22 '13 at 23:16
  • Judging by http://www.indyproject.org/docsite/html/!!MEMBEROVERVIEW_TIdIRC.html you have little lack with Indy unless they changed it after XE2 release. Well, they would have to change this, as it using strings for binary data is against XE4 guidelines. For now you can try using pre-Unicode Delphi or UTF-8 based CodeTyphon/Lazarus or fix the sources of Indy to add charset support. Maybe spawning IRC into separate thread with non-default codepage would help, but more probably would confuse Delphi RTL to have several codepages inside single applications. – Arioch 'The Jun 22 '13 at 23:17
  • is mIRC configured to use UTF8? configure it to use the same charset, that your Windows has... The last paragraph at http://synapse.ararat.cz/doku.php/public:howto:d2009 is about the similar issues that Indy has now. I guess that you should fix all the code on Indy IRC to fix UTF-16 strings of XE2 conversion to 8-byte strings of IRC and back. Or change the library. VisualIRC project has sources, but they were released to pre-unicode Delphi and may be of little help for you. Or not. Anyway, IRC is outdated and you can choose better chat options. Like IntranetChat remakes or XMPP – Arioch 'The Jun 22 '13 at 23:24
  • try Indy dev-snapshot, maybe they added charsets support to IRC, maybe not - download and look if their IRC code changed. But don't have high hopes – Arioch 'The Jun 22 '13 at 23:26
  • Thanks for all answers. I want this for twitch.tv and they use IRC for chat. mIRC can dispalys properly all characters set – user2512579 Jun 22 '13 at 23:28
  • Have you set the `TMemo` font to one that can display Unicode characters? It appears from the parameters to the event that Unicode is indeed supported, so it might just be a display issue with the memo control. – Ken White Jun 23 '13 at 01:10
  • Ken White i tried also displayed it on system message box – user2512579 Jun 23 '13 at 08:21
  • i cannot see that their chat is IRC-based. but try to set up IRC to use non-Unicode charset. And perhaps they have different TCP ports to connect with different charsets – Arioch 'The Jun 23 '13 at 16:08

1 Answers1

0

The IRC protocol itself does not provide any provisions for Unicode. mIRC implements Unicode by using UTF-8 where applicable (see this article).

TIdIRC does not natively support Unicode. However, you can manually tell TIdIRC to encode/decode data using UTF-8 by setting the TIdIOHandler.DefStringEncoding property to IndyUTF8Encoding after connecting, or by setting the global IdGlobal.GIdDefaultTextEncoding variable to encUTF8 (it is set to encASCII by default). I make no guarantee that it will work correctly in all situations though (particularly during CTC/DCC operations).

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770